/* ===== GLOBAL STYLES ===== */
:root {
  /* ===== PRIMARY BRAND COLORS - VIBRANT & NEON ===== */
  --cake-primary: #ffaa40;
  /* More vibrant orange */
  --cake-primary-hover: #ff922b;
  /* Richer hover */
  --cake-secondary: #00e6f2;
  /* Neon Cyan/Teal */
  --cake-secondary-hover: #00c7d4;
  /* Deeper teal hover */

  /* ===== STATUS COLORS - BRIGHT & CLEAR ===== */
  --cake-success: #00d26a;
  /* Vivid Green */
  --cake-danger: #f83b3b;
  /* Bright Red */
  --cake-warning: #ffb302;
  /* Amber/Gold */
  --cake-info: #2d9bf0;
  /* Azure Blue */

  /* ===== GLASSMORPHISM BASE COLORS (DARK MODE DEFAULT) ===== */
  /* Main background is now a deep, rich gradient canvas */
  --cake-bg: #0b0e14;
  /* Darker, almost black blue */

  /* Glass Surfaces - Use RGBA for transparency */
  --cake-surface: rgba(30, 41, 59, 0.7);
  /* Semi-transparent slate */
  --cake-surface-alt: rgba(15, 23, 42, 0.6);
  /* Darker glass */
  --cake-surface-elevated: rgba(51, 65, 85, 0.8);
  /* Higher glass */

  --cake-border: rgba(255, 255, 255, 0.08);
  /* Very subtle white border */
  --cake-border-light: rgba(255, 255, 255, 0.15);

  --glass-blur: 12px;
  /* Standard blur amount */
  --glass-saturate: 180%;
  /* Vivid colors behind glass */

  /* ===== TEXT COLORS ===== */
  --text-primary: #ffffff;
  /* Pure white for max contrast */
  --text-secondary: #94a3b8;
  /* Blue-tinted grey */
  --text-muted: #64748b;
  /* Darker grey */
  --text-highlight: #ffaa40;
  /* Primary color text */

  /* ===== INTERACTIVE STATE COLORS ===== */
  --hover-bg: rgba(255, 170, 64, 0.15);
  /* Orange tint */
  --active-bg: rgba(255, 170, 64, 0.25);
  --focus-ring: rgba(255, 170, 64, 0.4);

  /* ===== SHADOWS - GLOWING ===== */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(255, 170, 64, 0.15);
  /* Orange subtle glow */
  --shadow-glow-cyan: 0 0 20px rgba(0, 230, 242, 0.15);
  /* Cyan subtle glow */

  /* ===== SPACING & RADIUS ===== */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  --header-height: 70px;
  /* Slightly taller for breathing room */

  /* ===== Z-INDEX SCALE ===== */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;
  --z-notification: 900;
}

/* ===== LIGHT THEME OVERRIDES ===== */
html[data-theme="light"] {
  /* Surface colors - Clean modern light theme */
  --cake-bg: #f8fafc;
  /* Slate 50 background */
  --cake-surface: #ffffff;
  /* Pure white surfaces */
  --cake-surface-alt: #f1f5f9;
  /* Slate 100 for alternating */
  --cake-surface-elevated: #ffffff;
  /* White elevated */
  --cake-elevated: #f8fafc;
  /* Slate 50 elevated */
  --cake-border: rgba(148, 163, 184, 0.2);
  /* Subtle slate border */
  --cake-border-light: #e2e8f0;
  /* Slate 200 */
  --cake-accent: #ff9f43;
  /* Keep primary orange */
  --cake-accent-alt: #00d4e5;
  /* Brighter teal */

  /* Text colors - Better hierarchy */
  --text-primary: #0f172a;
  /* Slate 900 */
  --text-secondary: #475569;
  /* Slate 600 */
  --text-muted: #94a3b8;
  /* Slate 400 */

  /* Interactive state colors */
  --hover-bg: rgba(255, 159, 67, 0.06);
  --active-bg: rgba(255, 159, 67, 0.1);
  --focus-ring: rgba(255, 159, 67, 0.15);
  --focus-ring-strong: rgba(255, 159, 67, 0.25);

  /* Shadows for light theme - softer, more refined */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-dropdown: 0 10px 40px -10px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-drawer: -4px 0 20px rgba(0, 0, 0, 0.08);
  --shadow-drawer-lg: -8px 0 30px rgba(0, 0, 0, 0.1);
  --shadow-panel-bottom: 0 -4px 20px rgba(0, 0, 0, 0.06);
  --shadow-accent: 0 4px 14px rgba(255, 159, 67, 0.2);
  --shadow-accent-hover: 0 8px 25px rgba(255, 159, 67, 0.3);
  --shadow-secondary: 0 4px 14px rgba(0, 212, 229, 0.2);
  --shadow-danger: 0 4px 14px rgba(239, 68, 68, 0.2);
  --shadow-success: 0 4px 14px rgba(16, 185, 129, 0.2);

  /* Overlays */
  --overlay-dark: rgba(15, 23, 42, 0.6);
  --overlay-medium: rgba(15, 23, 42, 0.3);
  --overlay-light: rgba(15, 23, 42, 0.05);
}

/* Light theme nav bar override */
html[data-theme="light"] .mega-bar {
  background: rgba(255, 255, 255, 0.85);
  border-bottom-color: rgba(148, 163, 184, 0.15);
}

html[data-theme="light"] .mega-item .label {
  background: rgba(15, 23, 42, 0.03);
  color: var(--text-secondary);
}

html[data-theme="light"] .mega-item .label:hover {
  background: rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .mega-panel {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(148, 163, 184, 0.2);
}

/* ===== BASE ELEMENTS ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--cake-bg);
  /* Mesh Gradient Background */
  background-image:
    radial-gradient(at 0% 0%, rgba(255, 170, 64, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(0, 230, 242, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(255, 170, 64, 0.05) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(0, 230, 242, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  transition: all 0.3s ease;
}

/* Smooth theme transitions for all elements */
*,
*::before,
*::after {
  transition: background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    opacity 0.3s ease;
}

/* ===== LAYOUT COMPONENTS ===== */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
}

.wrapper {
  display: flex;
  min-height: 100vh;
  background-color: var(--cake-surface);
}

.left-panel {
  flex: 0 0 350px;
  overflow-y: auto;
  overflow-x: hidden;
  /* Glass Effect */
  background: var(--cake-surface-alt);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--cake-border);
  transition: width 0.3s ease;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--cake-surface);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
}

.right-sidebar {
  flex: 0 0 auto;
  max-width: 400px;
  min-width: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  /* Glass Effect */
  background: var(--cake-surface-alt);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-left: 1px solid var(--cake-border);
  transition: width 0.3s ease;
}

/* Hide right sidebar on smaller screens - handled in responsive section below */

/* ===== HEADER & NAVIGATION ===== */
.header {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 12px 24px;
  border-bottom: 1px solid var(--cake-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  gap: 8px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cake-primary) 0%, #ff8000 100%);
  color: #000;
  /* Dark text on bright orange */
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 15px rgba(255, 170, 64, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 170, 64, 0.5);
  filter: brightness(1.1);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  /* Glass button */
  backdrop-filter: blur(4px);
  color: var(--cake-secondary);
  border: 1px solid rgba(0, 230, 242, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: rgba(0, 230, 242, 0.15);
  border-color: var(--cake-secondary);
  box-shadow: 0 0 15px rgba(0, 230, 242, 0.2);
  color: #fff;
}

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

.btn-outline {
  background-color: transparent;
  color: var(--cake-accent);
  border: 2px solid var(--cake-accent);
  box-shadow: none;
}

.btn-outline:hover {
  background-color: var(--cake-accent);
  color: var(--text-white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--cake-border);
}

.btn-danger {
  background: linear-gradient(135deg, var(--cake-danger) 0%, #dc2626 100%);
  color: var(--text-white);
  border: none;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-danger);
}

.btn-success {
  background: linear-gradient(135deg, var(--cake-success) 0%, #059669 100%);
  color: var(--text-white);
  border: none;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-success);
}

.btn-sm,
.btn-small {
  padding: 7px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  padding: 12px 16px;
  font-size: 0.9rem;
  background: var(--cake-surface-alt);
  border: 2px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-normal);
  width: 100%;
}

.form-group input[type="text"]::placeholder,
.form-group input[type="email"]::placeholder,
.form-group input[type="password"]::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input[type="text"]:hover,
.form-group input[type="email"]:hover,
.form-group input[type="password"]:hover,
.form-group input[type="number"]:hover,
.form-group input[type="date"]:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: rgba(148, 163, 184, 0.3);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 4px var(--focus-ring), 0 4px 12px rgba(0, 0, 0, 0.1);
  background-color: var(--cake-surface);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
  line-height: 1.6;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ff9f43' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ===== CARDS & PANELS ===== */
.card {
  background: var(--cake-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cake-border);
}

.card-body {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* ===== PANELS ===== */
.panel {
  background: var(--cake-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-xl);
  padding: 0;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.panel:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(148, 163, 184, 0.25);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
  border-bottom: 1px solid var(--cake-border);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-content {
  padding: 20px;
}

.panel-body {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ===== TICKET LIST PANEL ===== */
.panel--ticket-list {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.ticket-list-item {
  padding: 16px;
  margin-bottom: 10px;
  background: var(--cake-surface-alt);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.ticket-list-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background var(--transition-fast);
}

.ticket-list-item:hover {
  background: var(--cake-surface);
  border-color: rgba(255, 159, 67, 0.3);
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.ticket-list-item:hover::before {
  background: linear-gradient(180deg, var(--cake-accent), var(--cake-accent-alt));
}

.ticket-list-item.active {
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.1) 0%, rgba(0, 212, 229, 0.05) 100%);
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px var(--focus-ring), var(--shadow-md);
}

.ticket-list-item.active::before {
  background: linear-gradient(180deg, var(--cake-accent), var(--cake-accent-alt));
}

.ticket-list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.ticket-list-item-id {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--cake-accent);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ticket-list-item-status {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.2), rgba(255, 159, 67, 0.1));
  color: var(--cake-accent);
  text-transform: uppercase;
}

.ticket-list-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  word-break: break-word;
}

.ticket-list-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ===== UNIFIED OVERLAY SYSTEM ===== */

/* Overlay Backdrop - shared backdrop for all overlays */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  /* Removed backdrop blur - too aggressive for overlays */
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Drawer overlay for KB/Agents drawers - no blur, positioned BEHIND drawer content */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  /* No backdrop blur for drawers */
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
  /* Allow clicks to pass through when hidden */
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  /* Enable clicks only when active */
}

/* Modal Container - centered modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.modal.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* Compatibility: Support both .active and .show classes */
.modal.show {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.modal.active .modal-content,
.modal.show .modal-content {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

.modal-content {
  background: var(--cake-surface);
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl), 0 0 60px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: scale(0.95) translateY(20px);
  transition: all var(--transition-slow);
}

/* Template Builder Modal - larger size */
.modal-content.template-modal {
  width: 95%;
  max-width: 900px;
  min-height: 500px;
}

/* Medium size modal */
.modal-content.modal-content--medium {
  max-width: 550px;
}

/* ===== Multi-Issue Modal Styles ===== */
.multi-issue-intro {
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.multi-issue-intro strong {
  color: var(--cake-accent);
}

.issue-selection-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.issue-selection-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.08) 0%, rgba(255, 159, 67, 0.02) 100%);
  border: 2px solid rgba(255, 159, 67, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.issue-selection-item:hover {
  border-color: var(--cake-accent);
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.15) 0%, rgba(255, 159, 67, 0.05) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 159, 67, 0.2);
}

.issue-selection-item.selected {
  border-color: var(--cake-accent);
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.2) 0%, rgba(255, 159, 67, 0.08) 100%);
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.15);
}

.issue-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--cake-accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

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

.issue-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.issue-summary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.issue-category-badge {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255, 159, 67, 0.15);
  border: 1px solid rgba(255, 159, 67, 0.3);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cake-accent);
}

.issue-action-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--cake-accent) 0%, #e8893e 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.issue-action-btn:hover {
  background: linear-gradient(135deg, #e8893e 0%, var(--cake-primary) 100%);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(255, 159, 67, 0.4);
}

.multi-issue-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.tip-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.tip-text {
  line-height: 1.5;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
  border-bottom: 1px solid var(--cake-border);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  font-size: 1.2rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--cake-danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(85vh - 140px);
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
  background: var(--cake-surface-alt);
  border-top: 1px solid var(--cake-border);
}

/* ===== UNIFIED ANIMATIONS ===== */

/* Fade In/Out */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* Scale In/Out - for modals */
@keyframes scaleIn {
  from {
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
  }

  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

@keyframes scaleOut {
  from {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  to {
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
  }
}

/* Slide In from Top */
@keyframes slideInTop {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide In from Bottom - for modals (legacy) */
@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide In from Right - for drawers */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== LISTS & TABLES ===== */
ul,
ol {
  margin-left: 20px;
}

li {
  margin-bottom: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

thead {
  background: var(--cake-surface-alt);
  border-bottom: 2px solid var(--cake-border);
}

th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary);
  text-transform: uppercase;
}

td {
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--cake-border);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background-color: var(--cake-elevated);
}

/* ===== MESSAGES & ALERTS ===== */
.alert {
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  animation: slideInUp 0.3s ease;
}

.alert-success {
  background-color: var(--success-bg);
  border-color: var(--cake-success);
  color: var(--success-text);
}

.alert-danger {
  background-color: var(--danger-bg);
  border-color: var(--cake-danger);
  color: var(--danger-text);
}

.alert-warning {
  background-color: var(--warning-bg);
  border-color: var(--cake-warning);
  color: var(--warning-text);
}

.alert-info {
  background-color: var(--info-bg);
  border-color: var(--cake-info);
  color: var(--info-text);
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
  margin-bottom: 12px;
  font-weight: 600;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.1rem;
}

h5 {
  font-size: 0.95rem;
}

h6 {
  font-size: 0.85rem;
}

p {
  margin-bottom: 12px;
  color: var(--text-primary);
}

a {
  color: var(--cake-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--cake-primary-hover);
  text-decoration: underline;
}

code {
  background: var(--cake-elevated);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--cake-accent);
}

/* ===== UTILITIES ===== */
.hidden {
  display: none !important;
}

/* Ensure HTML hidden attribute works even with display: flex */
[hidden] {
  display: none !important;
}

.visible {
  display: block !important;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

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

.text-accent {
  color: var(--cake-accent);
}

.text-success {
  color: var(--cake-success);
}

.text-danger {
  color: var(--cake-danger);
}

.mt-0 {
  margin-top: 0;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.ml-auto {
  margin-left: auto;
}

.mr-auto {
  margin-right: auto;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.gap-1 {
  gap: 4px;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 159, 67, 0.5);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Modern focus-visible states for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--cake-accent);
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--cake-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
}

/* Smooth page load animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.panel:nth-child(1) {
  animation-delay: 0.05s;
}

.panel:nth-child(2) {
  animation-delay: 0.1s;
}

.panel:nth-child(3) {
  animation-delay: 0.15s;
}

.panel:nth-child(4) {
  animation-delay: 0.2s;
}

.panel:nth-child(5) {
  animation-delay: 0.25s;
}

.panel:nth-child(6) {
  animation-delay: 0.3s;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== RESPONSIVE ===== */

/* ===== ULTRA-WIDE SCREENS (>=1921px) ===== */
@media (min-width: 1921px) {
  main {
    max-width: 1800px;
    margin: 0 auto;
  }

  body {
    font-size: 16px;
    /* Slightly larger for distance viewing */
  }

  .panel {
    padding: 20px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }
}

/* ===== NON-FULLSCREEN / MEDIUM DESKTOP (1281px-1400px) ===== */
@media (max-width: 1400px) and (min-width: 1281px) {
  main {
    gap: 16px;
    padding: 16px;
  }

  .panel {
    padding: 14px;
  }

  .right-sidebar {
    display: none;
  }
}

/* ===== SMALL LAPTOP SCREENS (1024px-1280px) ===== */
@media (max-width: 1280px) and (min-width: 1024px) {
  main {
    gap: 16px;
    padding: 16px;
  }

  .panel {
    padding: 12px;
  }

  h2 {
    font-size: 1.2rem;
  }

  .mega-inner {
    gap: 12px;
  }
}

/* ===== SMALL DESKTOP / LARGE TABLET (900px-1023px) ===== */
@media (max-width: 1023px) and (min-width: 900px) {
  main {
    gap: 14px;
    padding: 14px;
  }

  .panel {
    padding: 12px;
  }

  .panel-title {
    font-size: 0.85rem;
  }

  .btn {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.15rem;
  }
}

/* ===== PORTRAIT MODE (JS-applied class) ===== */
body.portrait-mode {

  /* Smooth transitions when panels collapse/expand */
  .panel {
    transition: all 0.2s ease-out;
  }

  /* Toast positioning for portrait */
  #toast-container {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  /* Reduce visual clutter */
  .panel-hint {
    font-size: 0.7rem;
  }

  .panel-subtitle {
    font-size: 0.75rem;
  }

  /* Compact collapsed panels even more */
  .panel.panel-collapsed {
    padding: 8px 12px;
  }

  .panel.panel-collapsed .panel-title {
    font-size: 0.85rem;
    margin: 0;
    padding: 0;
    border: none;
  }
}

/* ===== Portrait Mode FAB (Floating Action Button) ===== */
.portrait-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-500), var(--teal-500));
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.portrait-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.portrait-fab:active {
  transform: scale(0.95);
}

.portrait-fab[hidden] {
  display: none;
}

.portrait-fab-icon {
  line-height: 1;
}

/* Show FAB only in portrait mode */
@media (orientation: portrait) and (max-width: 1024px) {
  .portrait-fab:not([hidden]) {
    display: flex;
  }
}

@media (orientation: landscape),
(min-width: 1025px) {
  .portrait-fab {
    display: none !important;
  }
}

/* ===== PORTRAIT/VERTICAL ORIENTATION ===== */
@media (orientation: portrait) and (min-width: 768px) {
  main {
    grid-template-columns: 1fr !important;
    max-width: 800px;
    margin: 0 auto;
    gap: 16px;
    padding: 16px;
  }

  /* Single column layout for all panels */
  .column {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* Stack ticket top row vertically in portrait mode */
  .ticket-top-row {
    flex-direction: column !important;
    gap: 16px;
  }

  .ticket-top-row .dialpad-summary-container,
  .ticket-top-row .classification-section {
    width: 100% !important;
  }

  .ticket-top-row-resize-handle {
    display: none;
  }

  /* Expand classification grid to full width in portrait */
  .classification-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px;
  }

  /* Cleaner panel appearance */
  .panel {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .panel-title {
    font-size: 1rem;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--slate-700);
  }

  /* Better button layouts */
  .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .toolbar .btn {
    flex: 1 1 auto;
    min-width: 120px;
  }

  /* Improved form elements */
  .form-group {
    margin-bottom: 16px;
  }

  textarea {
    min-height: 100px;
  }

  /* Compact mega menu in portrait */
  .mega-inner {
    padding: 8px 16px;
  }

  .mega-rail {
    gap: 4px;
  }

  .mega-item .label {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  /* Live notes section improvements */
  #liveNotes {
    min-height: 150px;
  }

  #liveNotesSuggestions {
    max-height: 300px;
    overflow-y: auto;
  }

  .coaching-qa-item {
    padding: 12px !important;
  }

  .coaching-answer-input {
    font-size: 16px;
    /* Prevent zoom on iOS */
  }
}

/* ===== TABLET (768px-899px) ===== */
@media (max-width: 899px) and (min-width: 768px) {
  main {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
  }

  .column:last-child {
    grid-column: 1 / -1;
  }

  /* Touch-friendly buttons */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  /* Touch-friendly form inputs */
  input,
  textarea,
  select {
    min-height: 44px;
    font-size: 16px;
    /* Prevent zoom on iOS */
    padding: 10px 12px;
  }

  /* Collapsible panels by default on tablets */
  .panel {
    padding: 12px;
  }

  .panel-title {
    font-size: 0.9rem;
  }

  /* Stack ticket top row on tablets */
  .ticket-top-row {
    flex-direction: column;
    gap: 12px;
  }

  .ticket-top-row-resize-handle {
    display: none;
  }

  /* Make drawers wider on tablets */
  .kb-drawer {
    width: min(960px, 90vw);
  }

  .agents-drawer {
    width: min(600px, 95vw);
  }

  .notification-drawer {
    width: min(400px, 95vw);
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.1rem;
  }
}

/* ===== MOBILE / SMALL TABLET (480px-767px) ===== */
@media (max-width: 767px) and (min-width: 480px) {
  main {
    grid-template-columns: 1fr !important;
    gap: 12px;
    padding: 12px;
    padding-top: calc(var(--header-height) + 12px);
  }

  /* Touch-friendly buttons */
  .btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .btn-small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  /* Touch-friendly form inputs */
  input,
  textarea,
  select {
    min-height: 44px;
    font-size: 16px;
    /* Prevent zoom on iOS */
    padding: 10px 12px;
  }

  /* Stack ticket top row */
  .ticket-top-row {
    flex-direction: column;
    gap: 12px;
  }

  .ticket-top-row-resize-handle {
    display: none;
  }

  /* Full classification grid on mobile */
  .classification-grid {
    grid-template-columns: 1fr !important;
  }

  /* Hide less critical UI elements */
  .right-sidebar {
    display: none !important;
  }

  /* Responsive mega menu */
  .mega-inner {
    flex-wrap: wrap;
    gap: 8px;
  }

  .mega-rail {
    width: 100%;
    order: 3;
  }

  /* Full-width drawers on mobile */
  .kb-drawer,
  .agents-drawer,
  .notification-drawer,
  .saved-views-drawer {
    width: 100vw;
  }

  /* Full-screen modals on mobile */
  .modal-content {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  /* Bottom-fixed action buttons for ticket details */
  .ticket-primary-actions {
    position: sticky;
    bottom: 0;
    z-index: var(--z-sticky);
    background: var(--cake-surface-alt);
    border-top: 1px solid var(--cake-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  }

  .panel {
    padding: 12px;
  }

  h1 {
    font-size: 1.4rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  h3 {
    font-size: 1.05rem;
  }
}

/* ===== SMALL MOBILE (<480px) ===== */
@media (max-width: 479px) {
  .wrapper {
    flex-direction: column;
  }

  .left-panel {
    flex: 0 0 auto;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--cake-border);
  }

  main {
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 10px;
    padding-top: calc(var(--header-height) + 10px);
  }

  /* Enhanced touch-friendly buttons */
  .btn {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 0.85rem;
    width: 100%;
    justify-content: center;
  }

  .btn-small {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  /* Touch-friendly form inputs */
  input,
  textarea,
  select {
    min-height: 48px;
    font-size: 16px;
    /* Prevent zoom on iOS */
    padding: 12px;
  }

  /* Stack ticket top row */
  .ticket-top-row {
    flex-direction: column;
    gap: 10px;
  }

  .ticket-top-row-resize-handle {
    display: none;
  }

  /* Single column classification */
  .classification-grid {
    grid-template-columns: 1fr !important;
  }

  /* Hide less critical elements */
  .right-sidebar {
    display: none !important;
  }

  /* Compact mega menu */
  .mega-inner {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .brand {
    width: 100%;
    justify-content: center;
  }

  .mega-rail {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-right {
    width: 100%;
    justify-content: center;
  }

  /* Full-width drawers */
  .kb-drawer,
  .agents-drawer,
  .notification-drawer,
  .saved-views-drawer {
    width: 100vw;
  }

  /* Full-screen modals */
  .modal-content {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  /* Bottom-fixed action buttons */
  .ticket-primary-actions {
    position: sticky;
    bottom: 0;
    z-index: var(--z-sticky);
    background: var(--cake-surface-alt);
    border-top: 1px solid var(--cake-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    flex-direction: column;
  }

  .ticket-primary-actions .btn {
    width: 100%;
  }

  /* Stack button grids vertically on small mobile */
  .button-grid-4 {
    grid-template-columns: 1fr !important;
  }
}

/* ===== BUTTON GRID FOR TABLET/MOBILE (480px-899px) ===== */
@media (max-width: 899px) and (min-width: 480px) {
  .button-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel {
    padding: 14px;
  }

  h1 {
    font-size: 1.3rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  h3 {
    font-size: 1rem;
  }

  /* Compact spacing */
  .form-group {
    margin-bottom: 12px;
  }

  /* Better toolbar layout on tablet */
  .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .toolbar .btn-small {
    flex: 1 1 calc(50% - 4px);
    text-align: center;
    justify-content: center;
  }

  /* Make notification popups responsive */
  .notification-popup-container {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  /* Responsive data viz panel */
  .data-viz-content {
    grid-template-columns: 1fr;
  }

  .viz-stats {
    grid-column: span 1;
  }
}

/* ===== RESPONSIVE STICKY HEADERS ===== */
@media (max-width: 899px) {
  .mega-bar {
    position: sticky;
  }

  /* Make panels collapsible on smaller screens */
  .panel-header {
    cursor: pointer;
    user-select: none;
  }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {

  /* Increase touch targets */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-small {
    min-height: 36px;
    min-width: 36px;
  }

  /* Larger tap targets for interactive elements */
  .mega-item .label,
  .link-row,
  .kb-item,
  .ticket-list-item,
  .checklist-item-label {
    min-height: 44px;
    padding: 12px;
  }

  /* Remove hover effects on touch devices */
  .btn:hover,
  .card:hover,
  .panel:hover {
    transform: none;
  }

  /* Increase spacing between clickable elements */
  .header-actions,
  .nav-right,
  .toolbar {
    gap: 12px;
  }
}

/* ===== TICKET DETAILS PANEL - CLEAN FLEXBOX LAYOUT ===== */

.panel--ticket-details {
  position: relative;
  max-width: none;
  width: 100%;
  margin: 0 auto;
}

.ticket-primary-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  margin: 0 0 16px 0;
  background: var(--gradient-primary-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--focus-ring-strong);
}

.ticket-primary-actions .btn {
  flex: 0 0 auto;
}

/* Main grid - single column layout */
.ticket-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Main content column */
.ticket-col--main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* TOP ROW: Dialpad + Classification side by side */
.ticket-top-row {
  display: flex;
  gap: 16px;
  width: 100%;
  align-items: stretch;
}

/* DIALPAD CONTAINER - 50% width */
.dialpad-summary-container {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px;
  background: linear-gradient(135deg, var(--cake-surface), var(--cake-surface-alt));
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.dialpad-summary-container label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.dialpad-summary-container textarea {
  flex: 1;
  min-height: 140px;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  background: var(--cake-elevated);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  resize: vertical;
  transition: all 0.2s ease;
}

.dialpad-summary-container textarea:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* CLASSIFICATION CONTAINER - 50% width */
.classification-section {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  padding: 14px;
  background: linear-gradient(135deg, var(--cake-elevated), var(--cake-surface-alt));
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.classification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--focus-ring-strong);
}

.classification-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.classification-hint {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-style: italic;
}

.classification-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.classification-grid .form-group {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.classification-grid label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.classification-grid select {
  padding: 8px 10px;
  font-size: 0.75rem;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.classification-grid select:hover {
  border-color: var(--cake-accent);
  background: var(--cake-elevated);
}

.classification-grid select:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Main ticket fields below top row */
.form-group.compact {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#ticketSubject,
#ticketDescription,
#ticketResolution {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.82rem;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  line-height: 1.5;
  transition: all 0.2s ease;
}

#ticketSubject:focus,
#ticketDescription:focus,
#ticketResolution:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

#ticketDescription {
  min-height: 70px;
  resize: vertical;
}

#ticketResolution {
  min-height: 55px;
  resize: vertical;
}

/* Light theme adjustments for ticket components */
html[data-theme="light"] .dialpad-summary-container {
  background: linear-gradient(135deg, var(--cake-surface), var(--cake-surface-alt));
  border-color: var(--cake-border);
  box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .dialpad-summary-container textarea {
  background: var(--cake-surface);
  border-color: var(--cake-border);
  color: var(--text-primary);
}

html[data-theme="light"] .dialpad-summary-container textarea:focus {
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

html[data-theme="light"] .classification-section {
  background: linear-gradient(135deg, var(--cake-surface), var(--cake-surface-alt));
  border-color: var(--cake-border);
  box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .classification-header {
  border-bottom-color: var(--cake-border-light);
}

html[data-theme="light"] .classification-grid select {
  background: var(--cake-surface);
  border-color: var(--cake-border);
  color: var(--text-primary);
}

html[data-theme="light"] .classification-grid select:hover {
  border-color: var(--cake-accent);
  background: var(--cake-surface-alt);
}

html[data-theme="light"] #ticketSubject,
html[data-theme="light"] #ticketDescription,
html[data-theme="light"] #ticketResolution {
  background: var(--cake-surface);
  border-color: var(--cake-border);
  color: var(--text-primary);
}

html[data-theme="light"] #ticketSubject:focus,
html[data-theme="light"] #ticketDescription:focus,
html[data-theme="light"] #ticketResolution:focus {
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ===== NAVIGATION & HEADER ===== */
.mega-bar {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.mega-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  gap: 20px;
  max-width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--cake-accent) 0%, #e8893e 50%, var(--cake-accent-alt) 100%);
  color: var(--text-white);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.8px;
  box-shadow: 0 2px 10px rgba(255, 159, 67, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.version-badge {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 8px;
  letter-spacing: 0.3px;
  cursor: help;
  transition: all 0.2s ease;
}

.version-badge:hover {
  background: rgba(255, 159, 67, 0.15);
  border-color: rgba(255, 159, 67, 0.3);
  color: var(--cake-accent);
}

.mega-rail {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
}

.mega-rail::-webkit-scrollbar {
  height: 4px;
}

.mega-rail::-webkit-scrollbar-track {
  background: transparent;
}

.mega-rail::-webkit-scrollbar-thumb {
  background: var(--cake-border);
  border-radius: 2px;
}

/* Mega menu dropdown items */
.mega-item {
  position: relative;
  flex-shrink: 0;
}

.mega-item .label {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition-normal);
  user-select: none;
}

.mega-item .label:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--cake-border);
}

.mega-item.open .label {
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.15) 0%, rgba(0, 212, 229, 0.1) 100%);
  border-color: var(--cake-accent);
  color: var(--cake-accent);
  box-shadow: 0 0 15px rgba(255, 159, 67, 0.15);
}

.mega-wrap {
  position: fixed;
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: all var(--transition-normal);
  pointer-events: none;
}

.mega-item.open .mega-wrap {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mega-panel {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  min-width: 280px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 10px;
}

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

.link-row {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.link-row:hover {
  background: rgba(255, 159, 67, 0.08);
  border-color: rgba(255, 159, 67, 0.2);
  transform: translateX(4px);
}

.link-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.link-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.menu-separator {
  border: none;
  border-top: 1px solid var(--cake-border);
  margin: 6px 0;
}

.nav-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.nav-right .btn {
  border-radius: var(--radius-md);
}

.logout-form {
  margin: 0;
  display: inline-block;
}

/* ===== MAIN CONTENT AREA ===== */
main {
  padding-top: var(--header-height);
  background: var(--cake-bg);
  min-height: 100vh;
}

/* ===== BUTTON VARIANTS ===== */
.btn-accent {
  background: linear-gradient(135deg, var(--cake-accent) 0%, #e88a2e 100%);
  color: var(--text-white);
  border: none;
  box-shadow: 0 2px 8px rgba(255, 159, 67, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent-hover);
}

.btn-small {
  padding: 7px 14px;
  font-size: 0.8rem;
}

/* ===== ADMIN TOOLS ===== */
.admin-tools-footer {
  background: var(--cake-surface-alt);
  border-top: 1px solid var(--cake-border);
  padding: 12px 16px;
  margin-top: auto;
}

.admin-tools-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 100%;
}

.admin-tools-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-tools-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-btn {
  white-space: nowrap;
}

/* ===== NOTIFICATIONS ===== */
.notification-btn {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, var(--cake-danger) 0%, #dc2626 100%);
  color: var(--text-white);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  min-width: 20px;
  text-align: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.notification-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 90vw);
  height: 100vh;
  background: var(--cake-surface);
  border-left: 1px solid var(--cake-border);
  box-shadow: var(--shadow-drawer-lg);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
  border-bottom: 1px solid var(--cake-border);
}

.notification-drawer-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.notification-drawer-actions {
  display: flex;
  gap: 10px;
}

.notification-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.notification-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.notification-empty p {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.notification-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Slide In from Right - for drawers */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== DRAWER OVERLAY SYSTEM ===== */
/* Ensure hidden state works */
.drawer-overlay[hidden] {
  display: none !important;
}

/* Saved Views Drawer Overlay */
#savedViewsOverlay,
.saved-views-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  background: var(--overlay-medium);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#savedViewsOverlay.active,
.saved-views-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Saved Views Drawer - must be ABOVE overlay */
#savedViewsDrawer,
.saved-views-drawer {
  z-index: var(--z-modal);
}

/* Ensure hidden state works */
#savedViewsOverlay[hidden],
#savedViewsDrawer[hidden] {
  display: none !important;
}

/* ===== KNOWLEDGE BASE DRAWER ===== */
.kb-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(960px, 80vw);
  height: 100vh;
  background: var(--cake-surface);
  border-left: 1px solid var(--cake-border);
  box-shadow: var(--shadow-drawer-lg);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease;
}

.kb-drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.kb-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--cake-surface-alt);
  border-bottom: 1px solid var(--cake-border);
  font-weight: 600;
  color: var(--text-primary);
}

.kb-drawer-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.kb-layout {
  display: flex;
  height: 100%;
  gap: 0;
}

.kb-list-column {
  flex: 0 0 340px;
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid var(--cake-border);
  background: var(--cake-surface-alt);
}

.kb-article-column {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--cake-surface);
}

.kb-article-viewer {
  max-width: 800px;
}

.kb-article-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cake-border);
}

.kb-article-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.kb-article-body {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.kb-article-body h1,
.kb-article-body h2,
.kb-article-body h3 {
  margin-top: 24px;
  margin-bottom: 12px;
}

.kb-article-body ul,
.kb-article-body ol {
  margin-left: 24px;
  margin-bottom: 16px;
}

.kb-article-body li {
  margin-bottom: 8px;
}

/* ===== Guru Card Content Styles ===== */
/* These styles render Guru's HTML content properly in the KB article viewer */

.kb-article-body .ghq-card-content__paragraph,
.kb-article-body p[data-ghq-card-content-type="paragraph"] {
  margin-bottom: 1em;
  line-height: 1.7;
  color: var(--text-primary);
}

.kb-article-body .ghq-card-content__paragraph.ghq-is-empty,
.kb-article-body p.ghq-is-empty {
  display: none;
}

.kb-article-body .ghq-card-content__bulleted-list,
.kb-article-body ul[data-ghq-card-content-type="BULLETED_LIST"] {
  margin: 1em 0;
  padding-left: 1.5em;
  list-style-type: disc;
}

.kb-article-body .ghq-card-content__bulleted-list-item,
.kb-article-body li[data-ghq-card-content-type="BULLETED_LIST_ITEM"] {
  margin-bottom: 0.75em;
  line-height: 1.6;
  color: var(--text-primary);
}

.kb-article-body .ghq-card-content__numbered-list,
.kb-article-body ol[data-ghq-card-content-type="NUMBERED_LIST"] {
  margin: 1em 0;
  padding-left: 1.5em;
  list-style-type: decimal;
}

.kb-article-body .ghq-card-content__numbered-list-item,
.kb-article-body li[data-ghq-card-content-type="NUMBERED_LIST_ITEM"] {
  margin-bottom: 0.75em;
  line-height: 1.6;
  color: var(--text-primary);
}

.kb-article-body .ghq-card-content__bold,
.kb-article-body strong[data-ghq-card-content-type="BOLD"] {
  font-weight: 700;
  color: var(--text-primary);
}

.kb-article-body .ghq-card-content__italic,
.kb-article-body em[data-ghq-card-content-type="ITALIC"] {
  font-style: italic;
}

.kb-article-body .ghq-card-content__underline {
  text-decoration: underline;
}

.kb-article-body .ghq-card-content__link,
.kb-article-body a[data-ghq-card-content-type="LINK"] {
  color: var(--cake-accent);
  text-decoration: underline;
  cursor: pointer;
}

.kb-article-body .ghq-card-content__link:hover {
  text-decoration: none;
  opacity: 0.9;
}

.kb-article-body .ghq-card-content__heading,
.kb-article-body h1[data-ghq-card-content-type],
.kb-article-body h2[data-ghq-card-content-type],
.kb-article-body h3[data-ghq-card-content-type] {
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.75em;
  color: var(--text-primary);
}

.kb-article-body .ghq-card-content__code,
.kb-article-body code[data-ghq-card-content-type] {
  font-family: monospace;
  background: var(--cake-elevated);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

.kb-article-body .ghq-card-content__blockquote {
  border-left: 3px solid var(--cake-accent);
  padding-left: 1em;
  margin: 1em 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Hide empty elements */
.kb-article-body [class*="ghq-is-empty"] {
  display: none;
}

/* Ensure nested lists are properly styled */
.kb-article-body .ghq-card-content__bulleted-list .ghq-card-content__bulleted-list {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.kb-resize-handle {
  width: 4px;
  background: var(--cake-border);
  cursor: col-resize;
  transition: background 0.2s ease;
  position: relative;
}

.kb-resize-handle:hover {
  background: var(--cake-accent);
}

.kb-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.kb-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.kb-item:hover {
  background: var(--cake-elevated);
  border-color: var(--cake-accent);
  box-shadow: var(--focus-ring);
}

.badge-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

.analysis-block {
  margin-bottom: 16px;
}

.analysis-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* ===== GURU AGENTS DRAWER ===== */
.agents-drawer {
  width: min(600px, 90vw);
  z-index: var(--z-modal);
}

/* Ensure KB drawer and Agents drawer render ABOVE their overlays */
.kb-drawer,
.agents-drawer,
#agentsDrawer {
  z-index: var(--z-modal);
  /* Much higher than overlay (500 vs 400) */
  pointer-events: auto;
  /* Always allow clicks on drawer content */
}

.agents-chat-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.agent-selector {
  padding: 16px;
  background: var(--cake-surface-alt);
  border-bottom: 1px solid var(--cake-border);
}

.agent-selector-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: block;
}

.agent-selector-buttons {
  display: flex;
  gap: 8px;
}

.agent-select-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: var(--cake-surface);
  border: 2px solid var(--cake-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.agent-select-btn:hover {
  border-color: var(--cake-accent);
  background: var(--cake-elevated);
}

.agent-select-btn.active {
  border-color: var(--cake-accent);
  background: var(--cake-elevated);
  box-shadow: 0 0 0 2px var(--focus-ring-strong);
}

.agent-btn-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.agent-btn-tag {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--focus-ring-strong);
  color: var(--cake-accent);
  font-weight: 600;
}

.agent-tag-deep {
  background: var(--danger-bg);
  color: var(--cake-danger);
}

.agent-tag-fast {
  background: var(--success-bg);
  color: var(--cake-success);
}

.agent-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--cake-surface);
}

/* Chat Message Styles */
.chat-message {
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  max-width: 85%;
  line-height: 1.6;
  font-size: 0.875rem;
}

.chat-message.user {
  background: var(--cake-accent);
  color: var(--text-white);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chat-message.agent {
  background: var(--cake-elevated);
  color: var(--text-primary);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.chat-message.loading {
  opacity: 0.7;
  font-style: italic;
}

.chat-message .message-content {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-message .message-sources {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--cake-border);
  font-size: 0.75rem;
}

.chat-message .message-sources a {
  color: var(--cake-accent);
  text-decoration: underline;
}

.agent-chat-welcome {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
}

.agent-chat-welcome p {
  margin-bottom: 12px;
}

.agent-chat-input-container {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: var(--cake-surface-alt);
  border-top: 1px solid var(--cake-border);
}

.agent-chat-input {
  flex: 1;
  padding: 10px 12px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  resize: vertical;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.5;
}

.agent-chat-input:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.agent-chat-send {
  padding: 10px 20px;
  align-self: flex-end;
}

/* ===== PANELS & LAYOUT ===== */
.panel-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
  border-bottom: 1px solid var(--cake-border);
}

.panel-title-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.panel-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--cake-accent);
}

.title-accent {
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--cake-accent), var(--cake-accent-alt));
  border-radius: var(--radius-pill);
}

.guru-accent {
  background: linear-gradient(135deg, var(--cake-accent), var(--cake-accent-alt));
}

.collapse-btn {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.collapse-btn:hover {
  background: rgba(255, 159, 67, 0.1);
  color: var(--cake-accent);
  transform: scale(1.1);
}

/* ===== Collapsible Panel Content ===== */
.scroll-box,
.checklist-scroll,
.steps-scroll {
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.2s ease-out, padding 0.3s ease-out;
}

.collapsed {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden !important;
  visibility: hidden;
  /* Don't use display:none - it causes the grey block glitch */
}

/* Ensure expanded state has proper max-height */
.scroll-box:not(.collapsed),
.checklist-scroll:not(.collapsed),
.steps-scroll:not(.collapsed) {
  max-height: 9999px;
  /* Large enough to not clip content */
  opacity: 1;
  visibility: visible;
}

/* Prevent grey block from showing during collapse */
.checklist-host,
.scroll-box {
  background: transparent;
}

.count-pill {
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.2), rgba(255, 159, 67, 0.1));
  color: var(--cake-accent);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 26px;
  text-align: center;
  border: 1px solid rgba(255, 159, 67, 0.2);
  box-shadow: 0 2px 6px rgba(255, 159, 67, 0.15);
}

/* ===== CONTENT AREAS ===== */
.checklist-host {
  min-height: 100px;
}

.checklist-scroll {
  max-height: 500px;
  overflow-y: auto;
}

/* ===== CALL STEPS TRACKER - Modern UI ===== */

/* Quick Add Step Input */
.quick-add-step {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--cake-surface-alt) 0%, var(--cake-surface) 100%);
  border-bottom: 1px solid var(--cake-border);
}

.quick-step-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--cake-surface);
  border: 2px solid var(--cake-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.quick-step-input:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
  background: var(--cake-surface);
}

.quick-step-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Quick Action Buttons Bar */
.quick-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--cake-surface);
  border-bottom: 1px solid var(--cake-border);
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: linear-gradient(180deg, var(--cake-surface-alt) 0%, var(--cake-surface) 100%);
  border: 1px solid var(--cake-border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.quick-action-btn:hover {
  background: linear-gradient(180deg, var(--cake-accent) 0%, #e8893e 100%);
  border-color: var(--cake-accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 159, 67, 0.35);
}

.quick-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(255, 159, 67, 0.25);
}

/* Checklist Toolbar */
.checklist-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--cake-surface-alt);
  border-bottom: 1px solid var(--cake-border);
}

.checklist-toolbar .btn {
  border-radius: 8px;
  font-weight: 500;
}

/* Source Badge for manual entries */
.source-badge.manual {
  background: linear-gradient(135deg, var(--cake-surface-alt), var(--cake-surface));
  color: var(--text-secondary);
  border: 1px solid var(--cake-border);
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Checklist Items - Modern Style */
.checklist-item-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  margin: 0;
  background: var(--cake-surface);
  border-bottom: 1px solid var(--cake-border);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.85rem;
  line-height: 1.5;
}

.checklist-item-label:hover {
  background: var(--cake-surface-alt);
}

.checklist-item-label.checked {
  background: linear-gradient(90deg, rgba(76, 175, 80, 0.08) 0%, transparent 100%);
  color: var(--text-secondary);
}

.checklist-item-label.checked::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cake-success);
}

.checklist-item-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--cake-success);
  cursor: pointer;
  flex-shrink: 0;
}

.placeholder {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
  background: linear-gradient(180deg, transparent 0%, var(--cake-surface-alt) 100%);
  border-radius: 8px;
  margin: 16px;
}

.notes-textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.notes-textarea:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ===== DATA VISUALIZATION ===== */
.data-viz-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 500px;
  background: var(--cake-surface);
  border-top: 2px solid var(--cake-border);
  box-shadow: var(--shadow-panel-bottom);
  z-index: var(--z-popover);
  display: flex;
  flex-direction: column;
  animation: slideInUp 0.3s ease;
}

.data-viz-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--cake-surface-alt);
  border-bottom: 1px solid var(--cake-border);
}

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

.data-viz-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.data-viz-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.realtime-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--success-bg);
  border: 1px solid var(--cake-success);
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--cake-success);
}

.realtime-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--cake-success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.refresh-indicator {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chart-placeholder {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

.viz-card {
  background: var(--cake-surface-alt);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.viz-card h4 {
  font-size: 0.85rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.viz-chart {
  min-height: 150px;
}

.viz-stats {
  grid-column: span 2;
}

.viz-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.viz-stat {
  text-align: center;
}

.viz-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cake-accent);
  margin-bottom: 4px;
}

.viz-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Chart Bar Rows */
.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.chart-bar-row .chart-label {
  flex: 0 0 140px;
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-row .chart-bar {
  flex: 1;
  height: 20px;
  background: var(--cake-accent);
  border-radius: var(--radius-sm);
  min-width: 4px;
  transition: width 0.3s ease;
}

.chart-bar-row .chart-bar.ticket {
  background: var(--cake-primary);
}

.chart-bar-row .chart-bar.knowledge {
  background: var(--cake-accent);
}

.chart-bar-row .chart-bar.escalation {
  background: var(--cake-warning);
}

.chart-bar-row .chart-bar.coaching {
  background: var(--cake-success);
}

.chart-bar-row .chart-value {
  flex: 0 0 30px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* Timeline Chart */
.timeline-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 150px;
  gap: 8px;
  padding-top: 20px;
}

.timeline-bar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.timeline-bar {
  width: 100%;
  max-width: 40px;
  background: linear-gradient(to top, var(--cake-accent), var(--cake-primary));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 4px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin-top: auto;
  transition: height 0.3s ease;
  position: relative;
}

.timeline-count {
  position: absolute;
  top: -18px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-label {
  margin-top: 6px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ===== MODALS & OVERLAYS ===== */
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--cake-border);
  background: var(--cake-surface);
  flex-shrink: 0;
}

/* Escalation Modal - ensure buttons are always visible */
.escalation-modal {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  padding: 0;
  overflow: hidden;
}

.escalation-modal .modal-header {
  padding: 20px 24px 12px;
  flex-shrink: 0;
}

.escalation-modal .modal-subtitle {
  padding: 0 24px 12px;
  flex-shrink: 0;
  margin: 0;
}

/* Scrollable form area */
.escalation-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 16px;
  min-height: 0;
}

.escalation-modal .form-group {
  margin-bottom: 12px;
}

.escalation-modal .modal-actions {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
}

.modal-scroll {
  max-height: 60vh;
  overflow-y: auto;
  margin: 16px 0;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.quick-note-modal .modal-content {
  max-width: 500px;
}

.quick-note-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.shortcuts-modal .modal-content {
  max-width: 700px;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin: 24px 0;
}

.shortcut-section h3 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--cake-border);
  font-size: 0.85rem;
}

.shortcut-row:last-child {
  border-bottom: none;
}

.shortcut-row kbd {
  background: var(--cake-elevated);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cake-accent);
  min-width: 32px;
  text-align: center;
}

.shortcut-row span {
  color: var(--text-primary);
}

/* ===== SAVED VIEWS ===== */
.saved-views-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 90vw);
  height: 100vh;
  background: var(--cake-surface);
  border-left: 1px solid var(--cake-border);
  box-shadow: var(--shadow-drawer);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease;
}

.saved-views-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--cake-surface-alt);
  border-bottom: 1px solid var(--cake-border);
}

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

.saved-views-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.saved-views-section {
  margin-bottom: 32px;
}

.saved-views-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.saved-view-list,
.saved-filter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.saved-view-item,
.saved-filter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.saved-view-item:hover,
.saved-filter-item:hover {
  background: var(--cake-elevated);
  border-color: var(--cake-accent);
}

.saved-view-item.active {
  border-color: var(--cake-accent);
  background: var(--cake-elevated);
}

.saved-view-icon {
  font-size: 1.2rem;
}

.saved-view-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.filter-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
}

.priority-high {
  background: var(--danger-bg);
  color: var(--cake-danger);
  font-weight: 700;
}

.priority-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cake-danger);
  animation: pulse 2s ease-in-out infinite;
}

/* ===== SAVED PROFILE ITEMS ===== */
.saved-profile-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.saved-profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.saved-profile-item:hover {
  background: var(--cake-elevated);
  border-color: var(--cake-accent);
}

.saved-profile-item.active {
  border-color: var(--cake-accent);
  background: var(--cake-elevated);
  border-left: 3px solid var(--cake-accent);
}

.saved-profile-item .profile-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.saved-profile-item .profile-icon {
  font-size: 1rem;
}

.saved-profile-item .profile-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.saved-profile-item .profile-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--cake-accent);
  color: white;
  border-radius: 10px;
  font-weight: 600;
}

.saved-profile-item .profile-actions {
  display: flex;
  gap: 4px;
}

.saved-profile-item .btn-tiny {
  padding: 4px 6px;
  font-size: 0.75rem;
  min-width: auto;
}

.save-profile-form {
  display: flex;
  align-items: center;
}

.save-profile-form .input-field {
  padding: 8px 12px;
  font-size: 0.85rem;
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-sm);
  background: var(--cake-surface);
  color: var(--text-primary);
}

.save-profile-form .input-field:focus {
  outline: none;
  border-color: var(--cake-accent);
}

/* ===== TRANSCRIPT ===== */
.transcript-panel {
  margin: 12px 0;
}

.transcript-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--cake-surface-alt);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.transcript-header:hover {
  background: var(--cake-elevated);
  border-color: var(--cake-accent);
}

.transcript-toggle-icon {
  transition: transform 0.2s ease;
}

.transcript-panel.open .transcript-toggle-icon {
  transform: rotate(90deg);
}

.transcript-toggle-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.transcript-status {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.transcript-body {
  padding: 16px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.transcript-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding: 10px;
  background: var(--cake-elevated);
  border-left: 3px solid var(--cake-accent);
  border-radius: var(--radius-sm);
}

.transcript-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.transcript-process-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: 8px;
}

.scrubbed-preview {
  margin-top: 16px;
  padding: 12px;
  background: var(--cake-elevated);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
}

.scrubbed-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== FORM ELEMENTS ===== */
.sf-select {
  appearance: none;
  position: relative;
  padding-right: 30px;
}

.sf-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ff9f43' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Light theme: use darker arrow */
html[data-theme="light"] .sf-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232B6DE8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.sf-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.sf-checkbox input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.sf-checkbox span {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.mode-select {
  padding: 8px 12px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
}

.mode-select:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.15);
}

/* ===== BUTTON GRIDS ===== */
.button-grid {
  display: grid;
  gap: 8px;
}

.button-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Button grid responsive - handled in comprehensive responsive section above */

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 12px;
}

.toolbar.compact {
  padding: 4px 0;
  margin-bottom: 8px;
}

/* ===== STRETCH PANEL ===== */
.stretch-panel {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: 0;
}

/* ===== WORKFLOW LIST ===== */
.workflow-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.workflow-section {
  margin-bottom: 24px;
}

.workflow-section h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.workflow-section ul,
.workflow-section ol {
  margin-left: 20px;
}

.workflow-section li {
  margin-bottom: 6px;
  color: var(--text-primary);
}

/* ===== LIVE CALL NOTES ===== */
.live-notes-row {
  margin-bottom: 12px;
}

.live-notes-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

#liveNotes {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  resize: vertical;
}

#liveNotes:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.15);
}

/* ===== LIVE NOTES SUGGESTIONS ===== */
#liveNotesSuggestions {
  margin-top: 10px;
  border-radius: var(--radius-md);
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
}

.live-notes-hint,
.live-notes-loading,
.live-notes-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px !important;
}

.live-notes-hint .hint-icon,
.live-notes-error .error-icon {
  font-size: 1rem;
}

.live-notes-loading .loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--slate-600);
  border-top-color: var(--cake-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.live-notes-hint {
  color: var(--text-secondary);
  background: var(--slate-850);
}

.live-notes-loading {
  color: var(--cake-accent);
  background: rgba(255, 159, 67, 0.05);
}

.live-notes-error {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

/* ===== COACHING Q&A ITEMS ===== */
.coaching-qa-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px !important;
  background: var(--slate-850);
  border-left: 3px solid var(--cake-accent);
  margin-bottom: 6px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.coaching-qa-item.answered {
  border-left-color: var(--success);
  opacity: 0.7;
}

.coaching-question {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.coaching-answer-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.coaching-answer-input:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 2px rgba(255, 159, 67, 0.15);
}

.coaching-answer-input:disabled {
  background: var(--slate-900);
  border-color: var(--success);
  color: var(--success);
  cursor: not-allowed;
}

.coaching-answer-input::placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== PREVIEW ACTIONS ===== */
.preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== TEMPLATE MODAL ===== */
.template-modal {
  width: 95%;
  max-width: 850px;
  min-height: 500px;
}

.template-preview {
  margin-top: 16px;
}

.template-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-primary);
}

.sticky-footer {
  position: sticky;
  bottom: 0;
  background: var(--cake-surface);
  border-top: 1px solid var(--cake-border);
  padding-top: 16px;
  margin-top: 16px;
}

/* ===== FIELD LABEL ===== */
.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  resize: vertical;
  min-height: 80px;
}

.textarea:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.15);
}

/* ===== TICKET TOP ROW RESIZE HANDLE ===== */
.ticket-top-row-resize-handle {
  width: 8px;
  cursor: col-resize;
  background: var(--cake-border);
  transition: background 0.2s ease;
  border-radius: var(--radius-sm);
}

.ticket-top-row-resize-handle:hover {
  background: var(--cake-accent);
}

/* ===== PANEL SUBTITLE ===== */
.panel-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ===== STEPS & SCROLL AREAS ===== */
.steps-scroll {
  max-height: 400px;
  overflow-y: auto;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
}

.steps-textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
}

.steps-textarea:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.15);
}

.troubleshoot-scroll {
  max-height: 500px;
  overflow-y: auto;
  padding: 16px;
  background: linear-gradient(180deg, var(--cake-surface) 0%, var(--cake-surface-alt) 100%);
}

.troubleshooting-guide {
  padding: 16px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: 14px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ===== GURU AI Troubleshooting Enhancements ===== */

/* ===== GURU AI TROUBLESHOOTING - Modern UI ===== */

/* Quick Problem Buttons Bar */
.quick-problems-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.05) 0%, transparent 100%);
  border-bottom: 1px solid var(--cake-border);
}

.quick-problem-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quick-problem-btn:hover {
  background: linear-gradient(180deg, var(--cake-accent) 0%, #e8893e 100%);
  border-color: transparent;
  color: #fff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(255, 159, 67, 0.4);
}

.quick-problem-btn:active {
  transform: translateY(0) scale(1);
  box-shadow: 0 2px 8px rgba(255, 159, 67, 0.3);
}

/* Guru Search Container */
.guru-search-container {
  padding: 16px;
  background: linear-gradient(180deg, var(--cake-surface-alt) 0%, var(--cake-surface) 100%);
  border-bottom: 1px solid var(--cake-border);
  position: relative;
}

.guru-search-input-wrap {
  display: flex;
  gap: 10px;
}

.guru-search-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--cake-surface);
  border: 2px solid var(--cake-border);
  border-radius: 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.guru-search-input:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.15), 0 4px 20px rgba(0, 0, 0, 0.1);
}

.guru-search-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Search Suggestions Dropdown */
.guru-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 16px;
  right: 16px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
}

.suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--cake-border);
  transition: all 0.15s ease;
}

.suggestion-item:first-child {
  border-radius: 14px 14px 0 0;
}

.suggestion-item:last-child {
  border-bottom: none;
  border-radius: 0 0 14px 14px;
}

.suggestion-item:only-child {
  border-radius: 14px;
}

.suggestion-item:hover {
  background: linear-gradient(90deg, var(--cake-accent) 0%, #e8893e 100%);
  color: #fff;
}

.suggestion-item:hover .suggestion-category {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.suggestion-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.suggestion-category {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--cake-surface-alt);
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.15s ease;
}

/* Recent Searches */
.recent-searches {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--cake-surface);
  border-bottom: 1px solid var(--cake-border);
  flex-wrap: wrap;
}

.recent-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.recent-tag {
  padding: 6px 12px;
  background: var(--cake-surface-alt);
  border: 1px solid var(--cake-border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.recent-tag:hover {
  background: var(--cake-primary);
  border-color: var(--cake-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

/* Context-aware Suggestions */
.context-suggest {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(255, 159, 67, 0.12) 0%, rgba(255, 159, 67, 0.03) 100%);
  border-bottom: 1px solid rgba(255, 159, 67, 0.2);
  flex-wrap: wrap;
}

.context-label {
  font-size: 0.75rem;
  color: var(--cake-accent);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.context-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.context-tag {
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--cake-accent) 0%, #e8893e 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(255, 159, 67, 0.3);
}

.context-tag:hover {
  background: linear-gradient(135deg, #e8893e 0%, var(--cake-primary) 100%);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 15px rgba(255, 159, 67, 0.45);
}

/* Category Browser (collapsed) - Modern */
.category-browser {
  margin: 0;
  border-top: 1px solid var(--cake-border);
  background: var(--cake-surface);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.category-toggle {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--cake-surface-alt) 0%, var(--cake-surface) 100%);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.category-toggle::-webkit-details-marker {
  display: none;
}

.category-toggle::before {
  content: '▸';
  font-size: 0.9rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--cake-accent);
}

.category-browser[open] .category-toggle::before {
  transform: rotate(90deg);
}

.category-toggle:hover {
  background: linear-gradient(135deg, var(--cake-surface) 0%, var(--cake-surface-alt) 100%);
  color: var(--text-primary);
  padding-left: 22px;
}

/* ===== CAKE UNIVERSITY PANEL ===== */
.panel--cake-university {
  border-color: rgba(59, 130, 246, 0.3);
}

.university-accent {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

/* Category Buttons */
.university-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(37, 99, 235, 0.03) 100%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

.university-cat-btn {
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.08) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.university-cat-btn:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #3b82f6;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

/* Search Container */
.university-search-container {
  padding: 14px 16px;
  background: var(--cake-surface);
  border-bottom: 1px solid var(--cake-border);
}

.university-search-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
}

.university-search-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--cake-surface-alt);
  border: 2px solid var(--cake-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.university-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: var(--cake-surface);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), 0 4px 15px rgba(0, 0, 0, 0.1);
}

.university-search-input::placeholder {
  color: var(--text-secondary);
}

/* Recent Searches */
.university-recent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--cake-surface-alt);
  border-bottom: 1px solid var(--cake-border);
  flex-wrap: wrap;
}

.university-recent[hidden] {
  display: none;
}

/* Quick Links Browser */
.quick-links-browser {
  margin: 0;
  border-top: 1px solid var(--cake-border);
  background: var(--cake-surface);
  overflow: hidden;
}

.quick-links-toggle {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--cake-surface-alt) 0%, var(--cake-surface) 100%);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.quick-links-toggle::-webkit-details-marker {
  display: none;
}

.quick-links-toggle::before {
  content: '▸';
  font-size: 0.9rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #3b82f6;
}

.quick-links-browser[open] .quick-links-toggle::before {
  transform: rotate(90deg);
}

.quick-links-toggle:hover {
  background: linear-gradient(135deg, var(--cake-surface) 0%, var(--cake-surface-alt) 100%);
  color: var(--text-primary);
}

/* Quick Links Grid */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px 16px;
  background: var(--cake-surface);
}

.quick-link-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.03) 100%);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-link-item:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  text-decoration: none;
}

/* University Footer */
.university-footer {
  padding: 12px 16px;
  background: var(--cake-surface-alt);
  border-radius: 0 0 12px 12px;
  display: flex;
  justify-content: center;
}

.university-full-link {
  font-size: 0.82rem;
  color: #60a5fa;
}

.university-full-link:hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* ===== TICKET COLUMNS ===== */
.ticket-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Notification Pop-up System ===== */
.notification-popup-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: var(--z-notification);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.notification-popup {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  cursor: pointer;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  min-width: 280px;
}

.notification-popup-show {
  transform: translateX(0);
  opacity: 1;
}

.notification-popup-hide {
  transform: translateX(120%);
  opacity: 0;
}

.notification-popup-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
}

.notification-popup-content {
  flex: 1;
  min-width: 0;
}

.notification-popup-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.notification-popup-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  word-wrap: break-word;
}

.notification-popup-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s;
  margin-left: 8px;
}

.notification-popup-close:hover {
  opacity: 1;
}

/* Type-specific styles */
.notification-popup-success {
  border-left: 4px solid var(--cake-success);
}

.notification-popup-error {
  border-left: 4px solid var(--cake-danger);
}

.notification-popup-warning {
  border-left: 4px solid var(--cake-accent);
}

.notification-popup-info {
  border-left: 4px solid var(--cake-info-alt);
}

/* Hover effect */
.notification-popup:hover {
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
}

/* ===== Skeleton Loading States ===== */
.skeleton {
  background: linear-gradient(90deg,
      var(--cake-surface-alt) 25%,
      var(--cake-elevated) 50%,
      var(--cake-surface-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 1.5em;
  width: 40%;
  margin-bottom: 1em;
}

.skeleton-paragraph {
  height: 4em;
  margin-bottom: 1em;
}

.skeleton-button {
  height: 2.5em;
  width: 120px;
  border-radius: var(--radius-md);
}

.skeleton-list-item {
  height: 2.5em;
  margin-bottom: 0.75em;
  border-radius: var(--radius-sm);
}

/* Spinner for inline loading */
.spinner-inline {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid var(--cake-border);
  border-top-color: var(--cake-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Loading overlay for panels */
.panel-loading-overlay {
  position: absolute;
  inset: 0;
  /* Fallback RGB values (12, 17, 23) represent the default dark surface color (#0c1117) */
  background: rgba(var(--cake-surface-rgb, 12, 17, 23), 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  border-radius: inherit;
  z-index: 10;
}

.panel-loading-overlay .spinner-large {
  width: 40px;
  height: 40px;
  border: 3px solid var(--cake-border);
  border-top-color: var(--cake-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.panel-loading-overlay .loading-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Content loading state */
.content-loading {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

/* ===== TOAST NOTIFICATIONS ===== */
#toastHost {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: var(--z-toast, 800);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: 6px;
  padding: 12px 16px;
  min-width: 250px;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 0.9rem;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

/* Toast type variations */
.toast.ok {
  border-left: 4px solid var(--cake-accent);
}

.toast.err {
  border-left: 4px solid var(--cake-danger);
  background: linear-gradient(to right, var(--danger-bg), var(--cake-surface));
}

.toast.warn {
  border-left: 4px solid var(--cake-warning);
  background: linear-gradient(to right, var(--warning-bg), var(--cake-surface));
}

/* ===== LAYOUT PRESETS ===== */

/* Compact Layout - Reduces spacing and font sizes for denser information display */
body.layout-compact {
  font-size: 14px;
}

body.layout-compact main {
  gap: 12px;
  padding: 12px;
}

body.layout-compact .column {
  gap: 12px;
}

body.layout-compact .panel,
body.layout-compact .card {
  padding: 12px;
}

body.layout-compact .panel-title,
body.layout-compact .card h2 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

body.layout-compact .form-group {
  margin-bottom: 8px;
}

body.layout-compact label {
  font-size: 0.8rem;
  margin-bottom: 4px;
}

body.layout-compact input,
body.layout-compact textarea,
body.layout-compact select {
  padding: 6px 10px;
  font-size: 0.85rem;
}

body.layout-compact .btn {
  padding: 6px 12px;
  font-size: 0.8rem;
}

body.layout-compact .btn-small {
  padding: 4px 8px;
  font-size: 0.75rem;
}

/* Focus Layout - Hides non-essential elements for distraction-free work */
body.layout-focus .panel:not(:focus-within):not(:hover) {
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

body.layout-focus .panel:focus-within,
body.layout-focus .panel:hover {
  opacity: 1;
  transition: opacity 0.15s ease;
}

body.layout-focus .panel-hint,
body.layout-focus .placeholder {
  display: none;
}

body.layout-focus .form-group label {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ===== COLLAPSIBLE PANELS ===== */
.panel.panel-collapsed .panel-content,
.panel.panel-collapsed .toolbar,
.panel.panel-collapsed .scroll-box,
.panel.panel-collapsed .form-group,
.panel.panel-collapsed .button-grid,
.panel.panel-collapsed .ticket-grid,
.panel.panel-collapsed .analysis-block,
.panel.panel-collapsed .analysis-row,
.panel.panel-collapsed .live-notes-row,
.panel.panel-collapsed .panel-subtitle,
.panel.panel-collapsed .panel-hint,
.panel.panel-collapsed>*:not(.panel-title):not(.panel-drag-handle):not(.panel-title.panel-flex) {
  display: none !important;
}

.panel.panel-collapsed {
  padding-bottom: 12px;
}

.panel.panel-collapsed .collapse-btn {
  transform: rotate(-90deg);
}

.collapse-btn {
  transition: transform var(--transition-fast);
}

/* ===== DRAG AND DROP PANELS ===== */
.panel-drag-handle {
  position: absolute;
  top: 12px;
  left: 8px;
  width: 20px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0.3;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  z-index: 100;
  user-select: none;
  letter-spacing: -2px;
}

.panel-drag-handle:hover {
  opacity: 1;
  background: rgba(255, 159, 67, 0.1);
  color: var(--cake-accent);
  transform: scale(1.1);
}

.panel-drag-handle:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.panel[draggable="true"] {
  position: relative;
  overflow: visible;
}

/* Ensure drag handle is above all panel content */
.panel[draggable="true"] .panel-drag-handle {
  z-index: 100;
}

.panel[draggable="true"]>.panel-title,
.panel[draggable="true"]>h2,
.panel[draggable="true"]>.panel-title.panel-flex {
  padding-left: 28px;
}

/* Also handle nested title structures */
.panel[draggable="true"] .panel-title-left {
  padding-left: 4px;
}

.panel.dragging {
  opacity: 0.6;
  transform: scale(0.98) rotate(1deg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.panel.drag-over {
  border: 2px dashed var(--cake-accent);
  background: linear-gradient(135deg, rgba(255, 159, 67, 0.05), transparent);
  box-shadow: 0 0 20px rgba(255, 159, 67, 0.2);
}

/* ========== PERSONAL KB STYLES ========== */

/* KB Tab Navigation */
.kb-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--slate-800);
  border-radius: var(--radius-md);
}

.kb-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--slate-400);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.kb-tab:hover {
  color: var(--slate-200);
  background: var(--slate-700);
}

.kb-tab.active {
  background: var(--cake-accent);
  color: var(--slate-900);
}

.kb-tab-content {
  display: none;
}

.kb-tab-content.active {
  display: block;
}

/* Personal KB Tag Filters */
.personal-kb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}

.pkb-tag-btn {
  padding: 4px 10px;
  border: 1px solid var(--slate-600);
  background: var(--slate-800);
  color: var(--slate-400);
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pkb-tag-btn:hover {
  border-color: var(--cyan-500);
  color: var(--cyan-400);
}

.pkb-tag-btn.active {
  background: var(--cyan-500);
  border-color: var(--cyan-500);
  color: var(--slate-900);
}

/* Personal KB Actions Row */
.personal-kb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.pkb-import-export {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

/* Personal KB Preview List */
.personal-kb-preview {
  margin-top: 8px;
}

.pkb-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  max-height: 200px;
  overflow-y: auto;
}

.pkb-list li {
  padding: 8px 10px;
  background: var(--slate-800);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pkb-list li:hover {
  background: var(--slate-700);
  border-left: 2px solid var(--cyan-500);
}

.pkb-list li.pkb-empty {
  color: var(--slate-500);
  font-style: italic;
  cursor: default;
  justify-content: center;
}

.pkb-list li.pkb-empty:hover {
  background: var(--slate-800);
  border-left: none;
}

.pkb-entry-title {
  font-weight: 500;
  color: var(--slate-200);
  font-size: 0.85rem;
}

.pkb-entry-tags {
  display: flex;
  gap: 4px;
}

.pkb-entry-tag {
  padding: 2px 6px;
  background: var(--slate-700);
  color: var(--slate-400);
  font-size: 0.65rem;
  border-radius: 8px;
}

/* Personal KB Stats */
.personal-kb-stats {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--slate-500);
}

/* Personal KB Drawer */
.personal-kb-drawer {
  width: 85vw;
  max-width: 1200px;
}

.pkb-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 100px);
}

.pkb-list-column {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pkb-viewer-column {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

.pkb-search-bar {
  display: flex;
  gap: 8px;
}

.pkb-search-bar input {
  flex: 1;
}

.pkb-search-bar select {
  width: 120px;
}

.pkb-sort-bar {
  display: flex;
  gap: 4px;
}

.pkb-sort-btn {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: var(--slate-800);
  color: var(--slate-400);
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.pkb-sort-btn:hover {
  background: var(--slate-700);
  color: var(--slate-200);
}

.pkb-sort-btn.active {
  background: var(--cyan-600);
  color: white;
}

.pkb-entry-list {
  flex: 1;
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  border: 1px solid var(--slate-700);
  border-radius: var(--radius-md);
  background: var(--slate-850);
}

.pkb-entry-list li {
  padding: 12px;
  border-bottom: 1px solid var(--slate-700);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pkb-entry-list li:last-child {
  border-bottom: none;
}

.pkb-entry-list li:hover {
  background: var(--slate-800);
}

.pkb-entry-list li.selected {
  background: var(--slate-750);
  border-left: 3px solid var(--cyan-500);
}

.pkb-entry-list .pkb-entry-title {
  font-weight: 600;
  color: var(--slate-100);
  margin-bottom: 4px;
}

.pkb-entry-list .pkb-entry-preview {
  font-size: 0.75rem;
  color: var(--slate-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pkb-entry-list .pkb-entry-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.65rem;
  color: var(--slate-500);
}

/* PKB Viewer */
.pkb-viewer {
  background: var(--slate-850);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius-md);
  padding: 20px;
  height: 100%;
  overflow-y: auto;
}

.pkb-viewer-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--slate-500);
  font-style: italic;
}

.pkb-viewer-content h2 {
  color: var(--cyan-400);
  margin: 0 0 16px;
  font-size: 1.3rem;
}

.pkb-viewer-section {
  margin-bottom: 20px;
}

.pkb-viewer-section h4 {
  color: var(--slate-300);
  font-size: 0.85rem;
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--slate-700);
}

.pkb-viewer-section p,
.pkb-viewer-section ul {
  color: var(--slate-400);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.pkb-viewer-section ul {
  padding-left: 20px;
  margin: 0;
}

.pkb-viewer-section.script-section {
  background: var(--slate-800);
  border-left: 3px solid var(--teal-500);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.pkb-viewer-section.script-section p {
  color: var(--slate-200);
  font-style: italic;
}

.pkb-viewer-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-700);
}

.pkb-viewer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.pkb-viewer-tag {
  padding: 4px 10px;
  background: var(--slate-700);
  color: var(--cyan-400);
  font-size: 0.7rem;
  border-radius: 12px;
}

/* PKB Editor */
.pkb-editor {
  background: var(--slate-850);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius-md);
  height: 100%;
  overflow-y: auto;
}

.pkb-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-700);
  background: var(--slate-800);
  position: sticky;
  top: 0;
  z-index: 10;
}

.pkb-editor-header h3 {
  margin: 0;
  color: var(--cyan-400);
}

.pkb-editor-actions {
  display: flex;
  gap: 8px;
}

.pkb-editor-form {
  padding: 20px;
}

.pkb-editor-form .form-group {
  margin-bottom: 16px;
}

.pkb-editor-form label {
  display: block;
  font-size: 0.8rem;
  color: var(--slate-300);
  margin-bottom: 6px;
  font-weight: 500;
}

.pkb-editor-form input[type="text"],
.pkb-editor-form textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  border-radius: var(--radius-sm);
  color: var(--slate-100);
  font-size: 0.85rem;
}

.pkb-editor-form textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  line-height: 1.5;
}

.pkb-editor-form input:focus,
.pkb-editor-form textarea:focus {
  outline: none;
  border-color: var(--cyan-500);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* ========== BETTER GURU TAB STYLES ========== */
.better-guru-intro {
  font-size: 0.8rem;
  color: var(--slate-400);
  margin: 0 0 12px 0;
  padding: 0;
}

.better-guru-context-toggle {
  margin-bottom: 12px;
}

.better-guru-context-toggle .toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--slate-300);
  cursor: pointer;
}

.better-guru-context-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan-500);
}

.better-guru-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.better-guru-results-section,
.better-guru-sources-section {
  background: var(--slate-850);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius-sm);
  padding: 10px;
  min-height: 180px;
  max-height: 280px;
  overflow-y: auto;
}

.better-guru-results-section .badge-label,
.better-guru-sources-section .badge-label {
  margin-bottom: 8px;
}

.better-guru-sources-section .badge-label span {
  color: var(--slate-400);
  font-weight: normal;
}

/* Sort Toggle Buttons */
.sort-toggle {
  display: flex;
  gap: 4px;
}

.sort-btn {
  padding: 3px 6px;
  background: var(--slate-700);
  border: 1px solid var(--slate-600);
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0.6;
}

.sort-btn:hover {
  opacity: 0.9;
  background: var(--slate-600);
}

.sort-btn.active {
  opacity: 1;
  background: var(--cyan-700);
  border-color: var(--cyan-600);
}

.better-guru-results,
.better-guru-sources {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.better-guru-results .placeholder,
.better-guru-sources .placeholder {
  font-size: 0.75rem;
  color: var(--slate-500);
  text-align: center;
  padding: 20px 10px;
}

/* Guru Card Item (in search results) */
.guru-card-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.guru-card-item:hover {
  background: var(--slate-750);
  border-color: var(--cyan-600);
}

.guru-card-item.selected {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan-500);
}

.guru-card-checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--cyan-500);
  margin-top: 2px;
}

.guru-card-info {
  flex: 1;
  min-width: 0;
}

.guru-card-title {
  font-size: 0.8rem;
  color: var(--slate-100);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.guru-card-meta {
  font-size: 0.7rem;
  color: var(--slate-500);
}

.guru-card-preview-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  background: var(--slate-700);
  border: 1px solid var(--slate-600);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  color: var(--slate-300);
  cursor: pointer;
  transition: all 0.15s;
}

.guru-card-preview-btn:hover {
  background: var(--slate-600);
  color: var(--slate-100);
}

/* Selected Source Item */
.source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid var(--cyan-700);
  border-radius: var(--radius-sm);
}

.source-item-info {
  flex: 1;
  min-width: 0;
}

.source-item-title {
  font-size: 0.8rem;
  color: var(--cyan-300);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-item-remove {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--slate-600);
  border-radius: 50%;
  font-size: 0.8rem;
  color: var(--slate-400);
  cursor: pointer;
  transition: all 0.15s;
}

.source-item-remove:hover {
  background: var(--red-600);
  border-color: var(--red-600);
  color: white;
}

/* Generate Playbook Button */
.better-guru-generate {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--slate-700);
}

.better-guru-generate .btn {
  flex-shrink: 0;
}

.better-guru-generate .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.better-guru-generate .status-text {
  font-size: 0.75rem;
  color: var(--slate-400);
}

.better-guru-generate .status-text.loading {
  color: var(--amber-400);
}

.better-guru-generate .status-text.error {
  color: var(--red-400);
}

.better-guru-generate .status-text.success {
  color: var(--emerald-400);
}

/* ========== PLAYBOOK EDITOR DRAWER ========== */
.playbook-editor-drawer {
  max-width: 1000px;
  width: 95vw;
}

.playbook-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
  height: 100%;
}

.playbook-sources-column {
  background: var(--slate-850);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-y: auto;
}

.playbook-sources-column .badge-label {
  margin-bottom: 12px;
}

.playbook-source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playbook-source-item {
  display: block;
  padding: 10px 12px;
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s;
}

.playbook-source-item:hover {
  background: var(--slate-750);
  border-color: var(--cyan-600);
}

.playbook-source-title {
  font-size: 0.8rem;
  color: var(--cyan-300);
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playbook-source-meta {
  font-size: 0.7rem;
  color: var(--slate-500);
}

.playbook-source-info {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--slate-700);
}

.playbook-source-info p {
  font-size: 0.7rem;
  color: var(--slate-500);
  margin: 0;
  line-height: 1.4;
}

.playbook-form-column {
  overflow-y: auto;
}

.playbook-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 10px;
}

.playbook-form .form-group {
  margin-bottom: 0;
}

.playbook-form label {
  display: block;
  font-size: 0.8rem;
  color: var(--slate-300);
  margin-bottom: 6px;
  font-weight: 500;
}

.playbook-form input[type="text"],
.playbook-form textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--slate-800);
  border: 1px solid var(--slate-600);
  border-radius: var(--radius-sm);
  color: var(--slate-100);
  font-size: 0.85rem;
}

.playbook-form textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  line-height: 1.5;
}

.playbook-form input:focus,
.playbook-form textarea:focus {
  outline: none;
  border-color: var(--cyan-500);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* Responsive: Stack on smaller screens */
@media (max-width: 800px) {
  .better-guru-layout {
    grid-template-columns: 1fr;
  }

  .playbook-layout {
    grid-template-columns: 1fr;
  }

  .playbook-sources-column {
    max-height: 200px;
  }
}

.column.drag-over-column {
  background: rgba(255, 159, 67, 0.05);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 20px rgba(255, 159, 67, 0.1);
}

.drop-indicator {
  height: 4px;
  background: var(--cake-accent);
  border-radius: 2px;
  margin: 4px 0;
  animation: pulse-glow 1s infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 8px var(--cake-accent);
  }

  50% {
    box-shadow: 0 0 16px var(--cake-accent);
  }
}

/* ===== Dropdown Menu Styles ===== */
*/ .dropdown-wrap {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: var(--cake-surface);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: 6px 0;
  z-index: var(--z-dropdown);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.dropdown-menu:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: var(--hover-bg);
  color: var(--cake-accent);
}

/* Ensure dropdown works well in compact theme */
html[data-compact="1"] .dropdown-menu {
  min-width: 160px;
  padding: 4px 0;
}

html[data-compact="1"] .dropdown-item {
  padding: 8px 12px;
  font-size: 0.8rem;
}

/* ===== DRAWER READABILITY FIX ===== */
/* Ensure drawers are opaque enough to read content over the background */
.kb-drawer,
.agents-drawer,
.troubleshoot-drawer,
.drawer,
.personal-kb-drawer,
#kbDrawer,
#agentsDrawer,
#troubleshootDrawer,
.playbook-editor-drawer {
  background-color: #0b0e14 !important;
  /* Almost black */
  background-color: rgba(11, 14, 20, 0.96) !important;
  /* 96% opaque */
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.7) !important;
}

/* Ensure inner content containers don't double-up transparency */
.kb-drawer-inner,

/* ===== AI COMMAND BAR STYLES ===== */
.ai-command-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--cake-border);
  background: var(--cake-surface-alt);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.ai-command-input:focus {
  outline: none;
  border-color: var(--cake-accent);
  box-shadow: 0 0 0 3px rgba(43, 109, 232, 0.25);
  background: var(--cake-surface);
}

.ai-command-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--cake-surface-alt);
  border: 1px solid var(--cake-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.ai-result-header {
  padding: 8px 12px;
  background: rgba(43, 109, 232, 0.1);
  border-bottom: 1px solid var(--cake-border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cake-accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-results-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.ai-result-list {
  max-height: 300px;
  overflow-y: auto;
}

.ai-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--cake-border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.ai-result-item:last-child {
  border-bottom: none;
}

.ai-result-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ai-result-icon {
  font-size: 1.1rem;
  margin-top: 2px;
}

.ai-result-content div:first-child {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.ai-result-content div:last-child {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* FIX: Ensure AI results overflow the panel */
.panel--ai-command {
  overflow: visible !important;
  z-index: 10 !important;
  position: relative;
}