/**
 * Flow Design System - Main CSS
 * Extracted from web-components/style-guide.html
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
  /* Primary & Secondary (Legacy Miner colors) */
  --primary: #00285B;
  --primary-hover: #1E3E6E;
  --primary-active: #0D4F8B;
  --link: #0D4F8B;
  --link-hover: #00285B;
  /* Secondary uses cyan scheme (light bg with dark text) */
  --secondary: var(--cyan-light);
  --secondary-text: var(--cyan-dark);
  --secondary-hover: var(--cyan-dark);

  /* Primary light variant */
  --primary-light: var(--blue-light);
  --primary-text: var(--primary);

  /* Ghost/Default gray scheme */
  --ghost: var(--pearl);
  --ghost-text: var(--storm);
  --ghost-hover: var(--charcoal);

  /* Disabled state */
  --disabled-bg: var(--snow);
  --disabled-text: var(--ash);

  /* Contrast/Action uses orange (for CTAs like labflow actions) */
  --contrast: #fb8a25;
  --contrast-hover: #c4520f;
  --contrast-light: var(--orange-light);

  /* Avatar colors (12-color palette using middle tones from color families) */
  --avatar-1: var(--blue);       /* #07669a */
  --avatar-2: var(--indigo);     /* #444897 */
  --avatar-3: var(--lavender);   /* #744a98 */
  --avatar-4: var(--violet);     /* #983e7a */
  --avatar-5: var(--purple);     /* #af2b56 */
  --avatar-6: var(--red);        /* #e74a34 */
  --avatar-7: var(--orange);     /* #fc8c2d */
  --avatar-8: var(--gold);       /* #f8bc38 */
  --avatar-9: var(--lime);       /* #c4d44c */
  --avatar-10: var(--green);     /* #4dd491 */
  --avatar-11: var(--turquoise); /* #34d4b4 */
  --avatar-12: var(--cyan);      /* #2ab9d0 */

  /* Purple */
  --purple-light: #f3e3e9;
  --purple-muted: #cc7994;
  --purple: #af2b56;
  --purple-dark: #8b2e4f;
  --purple-verydark: #6a2440;

  /* Violet */
  --violet-light: #f0e4ec;
  --violet-muted: #bc849b;
  --violet: #983e7a;
  --violet-dark: #793a60;
  --violet-verydark: #5c2d4a;

  /* Lavender */
  --lavender-light: #eae7f0;
  --lavender-muted: #a48dbd;
  --lavender: #744a98;
  --lavender-dark: #5a3c80;
  --lavender-verydark: #442e62;

  /* Indigo */
  --indigo-light: #e5e7f1;
  --indigo-muted: #888bbd;
  --indigo: #444897;
  --indigo-dark: #353475;
  --indigo-verydark: #282859;

  /* Blue */
  --blue-light: #deeef4;
  --blue-muted: #619fbf;
  --blue: #07669a;
  --blue-dark: #074068;
  --blue-verydark: #052d47;

  /* Cyan */
  --cyan-light: #e8f5f6;
  --cyan-muted: #7ed3e1;
  --cyan: #2ab9d0;
  --cyan-dark: #1f8aa2;
  --cyan-verydark: #16677a;

  /* Turquoise */
  --turquoise-light: #e5f9f5;
  --turquoise-muted: #7de2d0;
  --turquoise: #2fd2b5;
  --turquoise-dark: #22a18b;
  --turquoise-verydark: #1a7a6a;

  /* Green */
  --green-light: #e8f8f0;
  --green-muted: #8fe3b9;
  --green: #4dd491;
  --green-dark: #3aa870;
  --green-verydark: #2c7f55;

  /* Lime */
  --lime-light: #eef5d9;
  --lime-muted: #d7e493;
  --lime: #bfd552;
  --lime-dark: #9fb043;
  --lime-verydark: #788533;

  /* Gold */
  --gold-light: #fdf0d4;
  --gold-muted: #fdd480;
  --gold: #fdbb36;
  --gold-dark: #dea432;
  --gold-verydark: #a87b26;

  /* Orange */
  --orange-light: #ffefe5;
  --orange-muted: #feb67d;
  --orange: #fc8c2d;
  --orange-dark: #de7d26;
  --orange-verydark: #a85e1d;

  /* Red */
  --red-light: #fde8e5;
  --red-muted: #f18d7f;
  --red: #e74a34;
  --red-dark: #c43d2b;
  --red-verydark: #942e21;

  /* Tinted Grayscale (subtle warm tint contrasting cool blue primary) */
  --white: #fefefd;
  --snow: #f9f8f7;
  --frost: #f2f1ef;
  --pearl: #ebeae8;
  --silver: #dfdedd;
  --ash: #b0afad;
  --slate: #6f6e6c;
  --storm: #4b4a48;
  --charcoal: #363533;
  --obsidian: #232221;

  /* Semantic */
  --frame-bg: #ECF0F5;
  --body-bg: #ECF0F5;
  --surface: var(--white);
  --surface-alt: var(--pearl);
  --surface-hover: var(--snow);
  --border-color: var(--pearl);
  --text-primary: var(--obsidian);
  --text-secondary: var(--slate);
  --sidebar-bg: var(--frame-bg);
  --sidebar-text: var(--slate);
  --sidebar-text-hover: var(--obsidian);
  --sidebar-selected-bg: var(--snow);
  --sidebar-selected-text: var(--obsidian);
  --surface-subtle: var(--frost);
  --surface-hover-alt: var(--silver);
  --text-on-color: var(--white);

  /* Heading accent (for section borders, decorative icons) */
  --heading-accent: var(--primary);
  --code-highlight: var(--primary);

  /* Radius */
  --radius: 5px;

  /* Shadow */
  --shadow: 0 0 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Dark Mode
   ========================================================================== */

[data-theme="dark"] {
  --frame-bg: var(--charcoal);
  --body-bg: var(--obsidian);
  --surface: var(--storm);
  --surface-alt: var(--charcoal);
  --surface-hover: var(--storm);
  --border-color: var(--storm);
  --text-primary: var(--snow);
  --shadow: 0 0 6px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.2);
  --text-secondary: var(--ash);
  /* Secondary in dark mode - dark bg with light text */
  --secondary: var(--cyan-verydark);
  --secondary-text: var(--cyan-light);
  --secondary-hover: var(--cyan-muted);
  /* Contrast in dark mode */
  --contrast: var(--orange-muted);
  --contrast-hover: var(--orange);
  --contrast-light: var(--orange-verydark);
  /* Sidebar grayscale in dark mode */
  --sidebar-bg: var(--charcoal);
  --sidebar-hover-bg: var(--storm);
  --sidebar-active-bg: var(--slate);
  --sidebar-text: var(--ash);
  --sidebar-text-hover: var(--white);
  --sidebar-selected-bg: var(--storm);
  --sidebar-selected-text: var(--white);
  /* Disabled state in dark mode (slightly lighter than card surface) */
  --disabled-bg: var(--slate);
  --disabled-text: var(--ash);
  --surface-subtle: var(--charcoal);
  --surface-hover-alt: var(--slate);
  --text-on-color: var(--white);
  /* Heading accent in dark mode - light blue for better visibility */
  --heading-accent: var(--blue-light);
  --code-highlight: var(--cyan);
  /* Links in dark mode - light blue for visibility on dark surfaces */
  --link: var(--blue-light);
  --link-hover: var(--blue-muted);
}

/* Dark mode: sidebar grayscale */
[data-theme="dark"] .sidebar-group { background: var(--sidebar-bg); }
[data-theme="dark"] .sidebar-item:not(.active):hover { background: var(--sidebar-hover-bg); }
[data-theme="dark"] .sidebar-item.active { background: var(--sidebar-active-bg); }

/* Dark mode: top bar */
[data-theme="dark"] .topbar h1 { color: var(--text-primary); }
[data-theme="dark"] .topbar-title i { color: var(--text-secondary); }

/* Dark mode: invert light buttons to dark style */
[data-theme="dark"] .btn-default { background: var(--surface-alt); color: var(--text-on-color); }
[data-theme="dark"] .btn-default:hover { background: var(--pearl); color: var(--text-primary); }
[data-theme="dark"] .btn-primary { background: var(--blue); color: var(--text-on-color); }
[data-theme="dark"] .btn-primary:hover { background: var(--blue-light); color: var(--blue-dark); }
[data-theme="dark"] .btn-secondary { background: var(--cyan); color: var(--text-on-color); }
[data-theme="dark"] .btn-secondary:hover { background: var(--cyan-light); color: var(--cyan-dark); }
[data-theme="dark"] .btn-warning { background: var(--orange); color: var(--text-on-color); }
[data-theme="dark"] .btn-warning:hover { background: var(--orange-light); color: var(--orange-dark); }
[data-theme="dark"] .btn-error { background: var(--red); color: var(--text-on-color); }
[data-theme="dark"] .btn-error:hover { background: var(--red-light); color: var(--red-dark); }
[data-theme="dark"] .btn-success { background: var(--green); color: var(--text-on-color); }
[data-theme="dark"] .btn-success:hover { background: var(--green-light); color: var(--green-dark); }

/* Dark mode: invert dark buttons to light style */
[data-theme="dark"] .btn-default-dark { background: var(--pearl); color: var(--text-primary); }
[data-theme="dark"] .btn-default-dark:hover { background: var(--surface-alt); color: var(--text-on-color); }
[data-theme="dark"] .btn-primary-dark { background: var(--blue-light); color: var(--blue-dark); }
[data-theme="dark"] .btn-primary-dark:hover { background: var(--blue); color: var(--text-on-color); }
[data-theme="dark"] .btn-secondary-dark { background: var(--cyan-light); color: var(--cyan-dark); }
[data-theme="dark"] .btn-secondary-dark:hover { background: var(--cyan); color: var(--text-on-color); }
[data-theme="dark"] .btn-warning-dark { background: var(--orange-light); color: var(--orange-dark); }
[data-theme="dark"] .btn-warning-dark:hover { background: var(--orange); color: var(--text-on-color); }
[data-theme="dark"] .btn-error-dark { background: var(--red-light); color: var(--red-dark); }
[data-theme="dark"] .btn-error-dark:hover { background: var(--red); color: var(--text-on-color); }
[data-theme="dark"] .btn-success-dark { background: var(--green-light); color: var(--green-dark); }
[data-theme="dark"] .btn-success-dark:hover { background: var(--green); color: var(--text-on-color); }

/* Dark mode: two-line action buttons (same as regular buttons) */
[data-theme="dark"] .two-line-default { background: var(--surface-alt); color: var(--text-on-color); }
[data-theme="dark"] .two-line-default:hover { background: var(--pearl); color: var(--text-primary); }
[data-theme="dark"] .two-line-primary { background: var(--blue); color: var(--text-on-color); }
[data-theme="dark"] .two-line-primary:hover { background: var(--blue-light); color: var(--blue-dark); }
[data-theme="dark"] .two-line-secondary { background: var(--cyan); color: var(--text-on-color); }
[data-theme="dark"] .two-line-secondary:hover { background: var(--cyan-light); color: var(--cyan-dark); }
[data-theme="dark"] .two-line-warning { background: var(--orange); color: var(--text-on-color); }
[data-theme="dark"] .two-line-warning:hover { background: var(--orange-light); color: var(--orange-dark); }
[data-theme="dark"] .two-line-error { background: var(--red); color: var(--text-on-color); }
[data-theme="dark"] .two-line-error:hover { background: var(--red-light); color: var(--red-dark); }
[data-theme="dark"] .two-line-success { background: var(--green); color: var(--text-on-color); }
[data-theme="dark"] .two-line-success:hover { background: var(--green-light); color: var(--green-dark); }

/* Dark mode: two-line text and icon colors inherit from parent */
[data-theme="dark"] .two-line-action .two-line-1,
[data-theme="dark"] .two-line-action .two-line-2,
[data-theme="dark"] .two-line-action .two-line-icon,
[data-theme="dark"] .two-line-action:hover .two-line-1,
[data-theme="dark"] .two-line-action:hover .two-line-2,
[data-theme="dark"] .two-line-action:hover .two-line-icon { color: inherit; }

/* Dark mode: cards */
[data-theme="dark"] .card-gray { background: var(--surface-alt); }
[data-theme="dark"] .card-tinted { background: var(--surface); }
[data-theme="dark"] .card-tinted-green { background: var(--surface); }
[data-theme="dark"] .card-tinted-orange { background: var(--surface); }
[data-theme="dark"] .card-tinted-purple { background: var(--surface); }

/* ==========================================================================
   Base Styles
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Manrope', sans-serif;
  background: var(--body-bg);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background 0.3s, color 0.3s;
  overflow: hidden;
  height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

a.text-link,
.data-table a,
.detail-card a,
.detail-section a {
  color: var(--link);
}

a.text-link:hover,
.data-table a:hover,
.detail-card a:hover,
.detail-section a:hover {
  color: var(--link-hover);
}

/* ==========================================================================
   Layout
   ========================================================================== */

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

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  width: 116px;
  background: transparent;
  color: var(--sidebar-text);
  padding: 16px;
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}

/* Sidebar groups (primary background rectangles) */
.sidebar-group {
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  padding-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.sidebar-header {
  width: 100%;
  height: 64px;
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sidebar-header i {
  font-size: 32px;
  color: var(--text-on-color);
}

.sidebar-logo {
  width: 32px;
  height: auto;
}

/* Sidebar items */
.sidebar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  padding: 4px;
  color: var(--text-on-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  transition: background 0.2s;
  border-radius: var(--radius);
}

.sidebar-item + .sidebar-item {
  margin-top: 8px;
}

.sidebar-item span {
  display: block;
}

.sidebar-item i {
  font-size: 24px;
  flex-shrink: 0;
  opacity: 0.8;
}

/* Hover state for unselected items */
.sidebar-item:not(.active):hover {
  background: var(--primary-active);
}

/* Active/selected item */
.sidebar-item.active {
  background: var(--primary-hover);
}

.sidebar-item.active i {
  opacity: 1;
}

.sidebar-item-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  user-select: none;
}

/* Spacer to push theme toggle to bottom */
.sidebar-spacer {
  flex: 1;
}

/* ==========================================================================
   Content Wrapper
   ========================================================================== */

.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-left: 0;
  height: 100vh;
  min-height: 0;
}

/* ==========================================================================
   Top Bar
   ========================================================================== */

.topbar {
  padding: 8px 16px 8px 0;
  margin-bottom: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.topbar-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  height: 48px;
  background: transparent;
  border-radius: var(--radius);
}

.topbar-title i {
  font-size: 22px;
  color: var(--text-secondary);
  opacity: 0.9;
}

.topbar h1 {
  margin: 0;
  color: var(--primary);
  font-size: 20px;
  line-height: 24px;
  font-weight: 600;
}

/* Topbar breadcrumb navigation */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  line-height: 24px;
}

.topbar-service {
  color: var(--text-secondary);
  font-weight: 400;
  text-decoration: none;
}

.topbar-separator {
  color: var(--text-muted);
  font-weight: 300;
}

.topbar-crumb {
  color: var(--text-secondary);
  font-weight: 400;
  text-decoration: none;
}

.topbar-crumb:hover {
  color: var(--primary);
}

.topbar-crumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 64px;
  background: transparent;
  border-radius: var(--radius);
}

.topbar-user-email {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
}

.topbar-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 100;
}

.topbar-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.topbar-user-dropdown-item:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.topbar-user-dropdown-item:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.topbar-user-dropdown-item:hover {
  background: var(--surface-hover);
}

.topbar-user-dropdown-item i {
  font-size: 18px;
  color: var(--text-secondary);
}

/* Topbar Context Buttons (Org, Project, User) */
.topbar-context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-context-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.15s;
}

.topbar-context-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.topbar-context-btn i {
  font-size: 18px;
  color: var(--text-secondary);
}

.topbar-context-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-context-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.topbar-context-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* User menu with dropdown - reuses two-line-action styling */
.topbar-user-menu {
  position: relative;
  cursor: pointer;
}

.topbar-user-menu .topbar-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s;
  z-index: 100;
}

.topbar-user-menu.open .topbar-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Context dropdown menus (org/project switcher) — mirrors user menu */
.topbar-context-menu {
  position: relative;
  cursor: pointer;
}

.topbar-context-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s;
  z-index: 100;
}

.topbar-context-menu.open .topbar-context-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.topbar-context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.topbar-context-item:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.topbar-context-item:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.topbar-context-item:hover {
  background: var(--surface-hover);
}

.topbar-context-item i {
  font-size: 16px;
  color: var(--text-secondary);
}

.topbar-context-item.active {
  background: var(--blue-light);
  color: var(--primary);
  font-weight: 500;
}

.topbar-context-item.active i {
  color: var(--primary);
}

/* Button items inside dropdown — reset browser button styling */
button.topbar-context-item {
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
}

/* Legacy user button with border - deprecated */
.topbar-user-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.topbar-user-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.topbar-user-btn.open .topbar-chevron {
  transform: rotate(180deg);
}

.topbar-user-btn .topbar-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s;
  z-index: 100;
}

.topbar-user-btn.open .topbar-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.content-row {
  flex: 1;
  display: flex;
  gap: 16px;
  min-height: 0;
}

.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  background: var(--body-bg);
  border-radius: 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* Toolbar - vertical bar on left of main-container */
#tool-bar {
  width: 64px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}

/* Toolbar buttons */
.toolbar-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.toolbar-btn:hover {
  background: var(--surface-alt);
  color: var(--text-primary);
}

.toolbar-btn.active {
  background: var(--primary);
  color: var(--text-on-color);
}

.toolbar-btn i {
  font-size: 20px;
}

.toolbar-divider {
  width: 32px;
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Audit Log - right-side panel, hidden by default, toggled via JS */
#audit-log {
  display: none;
  flex-shrink: 0;
  min-height: 0;
}

#audit-log.open {
  display: flex;
  flex-direction: column;
  width: 300px;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 80px);
}

#audit-log .section-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

#audit-log .section-card-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Audit Log - card items (used by activity_row.html compact mode) */
.audit-drawer-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
}

.audit-drawer-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.audit-drawer-item-ago {
  font-size: 11px;
  color: var(--text-secondary);
}

.audit-drawer-item-user {
  font-size: 11px;
  color: var(--text-secondary);
}

.audit-drawer-item-action {
  margin-top: 0;
}

/* Scrollbar */
.main-content::-webkit-scrollbar {
  width: 20px;
}

.main-content::-webkit-scrollbar-track {
  background-color: var(--surface-alt);
  background-clip: padding-box;
  border: 4px solid transparent;
  border-top: none;
  border-bottom: none;
  border-radius: 10px;
}

.main-content::-webkit-scrollbar-thumb {
  background-color: var(--text-secondary);
  background-clip: padding-box;
  border: 4px solid transparent;
  border-top: none;
  border-bottom: none;
  border-radius: 10px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-primary);
}

.main-content::-webkit-scrollbar-button {
  display: none;
  height: 0;
  width: 0;
}

/* ==========================================================================
   Theme Toggle
   ========================================================================== */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  margin-top: auto;
}

.toggle-switch {
  position: relative;
  width: 56px;
  height: 28px;
  background: var(--primary-hover);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
}

.toggle-switch i {
  font-size: 16px;
  color: var(--text-on-color);
  opacity: 0.7;
}

.toggle-switch .sun { order: 1; }
.toggle-switch .moon { order: 2; }

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: var(--primary-active);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
}

[data-theme="dark"] .toggle-switch::after {
  transform: translateX(28px);
}

/* ==========================================================================
   Typography
   ========================================================================== */

section {
  margin-bottom: 40px;
}

section:last-child {
  margin-bottom: 0;
}

h1 {
  font-weight: 600;
  font-size: 32px;
  line-height: 40px;
}

h2 {
  font-weight: 600;
  font-size: 32px;
  line-height: 40px;
  margin-bottom: 24px;
}

h3 {
  font-weight: 500;
  font-size: 24px;
  line-height: 32px;
  margin-bottom: 16px;
}

p {
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Typography Scale Classes */
.font-heading { font-weight: 700; font-size: 32px; line-height: 40px; opacity: 1.0; }
.font-title { font-weight: 600; font-size: 20px; line-height: 24px; opacity: 0.9; }
.font-body { font-weight: 400; font-size: 16px; line-height: 24px; opacity: 1.0; }
.font-body-bold { font-weight: 600; font-size: 16px; line-height: 24px; opacity: 1.0; }
.font-caption { font-weight: 300; font-size: 14px; line-height: 20px; opacity: 1.0; }
.font-caption-bold { font-weight: 600; font-size: 14px; line-height: 20px; opacity: 1.0; }
.font-label { font-weight: 600; font-size: 12px; line-height: 16px; opacity: 1.0; }
.font-label-light { font-weight: 400; font-size: 12px; line-height: 16px; opacity: 1.0; }
.font-small { font-weight: 400; font-size: 10px; line-height: 14px; opacity: 0.7; }
.font-small-bold { font-weight: 500; font-size: 10px; line-height: 14px; opacity: 0.9; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card h4 {
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  opacity: 1.0;
  margin-bottom: 8px;
}

.card p {
  font-weight: 300;
  font-size: 14px;
  line-height: 20px;
  opacity: 1.0;
  margin: 0;
}

/* Tagged Card */
.card-tagged {
  position: relative;
  padding-top: 48px;
}

.card-tagged .tag {
  position: absolute;
  top: 16px;
  left: 20px;
}

/* Primary Card */
.card-primary {
  background: var(--primary);
}

.card-primary h4,
.card-primary p {
  color: var(--text-on-color);
}

/* Gray Card */
.card-gray {
  background: var(--surface-alt);
}

/* Tinted Card (Blue) */
.card-tinted {
  background: var(--blue-light);
}

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

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

/* Tinted Card (Green) */
.card-tinted-green {
  background: var(--green-light);
}

.card-tinted-green h4 {
  color: var(--text-primary);
}

.card-tinted-green p {
  color: var(--text-secondary);
}

/* Tinted Card (Orange) */
.card-tinted-orange {
  background: var(--orange-light);
}

.card-tinted-orange h4 {
  color: var(--text-primary);
}

.card-tinted-orange p {
  color: var(--text-secondary);
}

/* Tinted Card (Purple) */
.card-tinted-purple {
  background: var(--purple-light);
}

.card-tinted-purple h4 {
  color: var(--text-primary);
}

.card-tinted-purple p {
  color: var(--text-secondary);
}

/* Dark Card */
.card-dark {
  background: var(--surface-alt);
}

.card-dark h4,
.card-dark p {
  color: var(--text-on-color);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  height: 42px;
  box-sizing: border-box;
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  opacity: 1.0;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}


.btn:active {
  filter: brightness(0.95);
}

/* Light buttons - subtle darkening */
.btn-light:hover {
  filter: brightness(0.95);
}

/* Dark buttons - brightening */
.btn-dark:hover {
  filter: brightness(1.2);
}

/* === LIGHT BUTTONS (default - light bg, dark text → solid on hover) === */
.btn-default {
  background: var(--ghost);
  color: var(--ghost-text);
}
.btn-default:hover {
  background: var(--ghost-hover);
  color: var(--text-on-color);
}

.btn-primary {
  background: var(--blue-light);
  color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary);
  color: var(--text-on-color);
}

.btn-secondary {
  background: var(--cyan-light);
  color: var(--cyan-dark);
}
.btn-secondary:hover {
  background: var(--cyan-dark);
  color: var(--text-on-color);
}

.btn-warning {
  background: var(--orange-light);
  color: var(--orange-dark);
}
.btn-warning:hover {
  background: var(--orange-dark);
  color: var(--text-on-color);
}

.btn-error {
  background: var(--red-light);
  color: var(--red-dark);
}
.btn-error:hover {
  background: var(--red-dark);
  color: var(--text-on-color);
}

.btn-success {
  background: var(--green-light);
  color: var(--green-dark);
}
.btn-success:hover {
  background: var(--green-dark);
  color: var(--text-on-color);
}

.btn-disabled, .btn:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  cursor: not-allowed;
  pointer-events: none;
}

/* === DARK BUTTONS (solid bg, white text → inverts to light on hover) === */
.btn-default-dark {
  background: var(--ghost-hover);
  color: var(--text-on-color);
}
.btn-default-dark:hover {
  background: var(--ghost);
  color: var(--ghost-text);
}

.btn-primary-dark {
  background: var(--primary);
  color: var(--text-on-color);
}
.btn-primary-dark:hover {
  background: var(--blue-light);
  color: var(--primary);
}

.btn-secondary-dark {
  background: var(--cyan-dark);
  color: var(--text-on-color);
}
.btn-secondary-dark:hover {
  background: var(--cyan-light);
  color: var(--cyan-dark);
}

.btn-warning-dark {
  background: var(--orange-dark);
  color: var(--text-on-color);
}
.btn-warning-dark:hover {
  background: var(--orange-light);
  color: var(--orange-dark);
}

.btn-error-dark {
  background: var(--red-dark);
  color: var(--text-on-color);
}
.btn-error-dark:hover {
  background: var(--red-light);
  color: var(--red-dark);
}

.btn-success-dark {
  background: var(--green-dark);
  color: var(--text-on-color);
}
.btn-success-dark:hover {
  background: var(--green-light);
  color: var(--green-dark);
}


/* Icons inherit text color */
.btn i { color: inherit; }

/* Buttons with icons have reduced padding */
.btn:has(i) {
  padding: 12px 14px;
}

.btn-md {
  padding: 9px 16px;
  height: 34px;
  font-size: 12px;
  line-height: 16px;
}

.btn-md:has(i) {
  padding: 9px 12px;
}

.btn-sm {
  padding: 6px 12px;
  height: 28px;
  font-size: 12px;
  line-height: 16px;
}

.btn-sm:has(i) {
  padding: 6px 10px;
}

.btn-stacked {
  flex-direction: column;
  padding: 3px 14px 2px 14px;
  height: 42px;
  background: var(--surface-alt);
  color: var(--text-primary);
}

.btn-stacked:hover {
  filter: brightness(1.03);
}

.btn-stacked .btn-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 16px;
}

.btn-stacked .btn-subtitle {
  font-weight: 300;
  font-size: 14px;
  line-height: 16px;
}

.btn-stacked-white {
  background: var(--surface);
}

.btn-stacked-white .btn-title {
  color: var(--text-secondary);
}

.btn-stacked-white .btn-subtitle {
  color: var(--text-secondary);
  opacity: 0.7;
}

.btn-stacked-tinted {
  background: var(--cyan-light);
  color: var(--cyan-dark);
}

.btn-stacked-tinted .btn-subtitle {
  color: var(--cyan);
}

.btn-inactive {
  background: var(--surface-alt);
  color: var(--text-secondary);
  gap: 8px;
  padding: 5px 5px 5px 12px;
  height: 34px;
  font-size: 12px;
  line-height: 16px;
  cursor: default;
  pointer-events: none;
}

.btn-inactive:hover {
  box-shadow: none;
  filter: none;
  transition: none;
}

/* ==========================================================================
   Two-Line Action Buttons
   ========================================================================== */

.two-line-action {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  min-height: 42px;
  border-radius: var(--radius);
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.two-line-action:focus {
  outline: none;
}

.two-line-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.two-line-1 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.two-line-2 {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
}

/* Horizontal layout (with avatar/icon on right) */
.two-line-horizontal {
  flex-direction: row;
  gap: 10px;
  padding: 6px 10px 6px 14px;
}

.two-line-horizontal .two-line-content {
  align-items: flex-start;
  text-align: left;
  flex: 1;
}

/* Avatar circle — uses unified .avatar component from tag.html */

/* Icon on right */
.two-line-icon {
  font-size: 16px;
  flex-shrink: 0;
  color: inherit;
}

/* Icon matches line-2 color (one step lighter than line-1) */
.two-line-default .two-line-icon { color: var(--text-secondary); }
.two-line-default:hover .two-line-icon { color: var(--text-on-color); }
.two-line-primary .two-line-icon { color: var(--blue-dark); }
.two-line-primary:hover .two-line-icon { color: var(--text-on-color); }
.two-line-secondary .two-line-icon { color: var(--cyan); }
.two-line-secondary:hover .two-line-icon { color: var(--text-on-color); }
.two-line-warning .two-line-icon { color: var(--contrast); }
.two-line-warning:hover .two-line-icon { color: var(--text-on-color); }
.two-line-error .two-line-icon { color: var(--red); }
.two-line-error:hover .two-line-icon { color: var(--text-on-color); }
.two-line-success .two-line-icon { color: var(--green); }
.two-line-success:hover .two-line-icon { color: var(--text-on-color); }
.two-line-disabled .two-line-icon { color: var(--disabled-text); }

/* Width variants */
.two-line-full {
  width: 100%;
}

.two-line-fixed {
  min-width: 100px;
  max-width: 180px;
}

/* Text overflow for line2 (value line) */
.two-line-fixed .two-line-2,
.two-line-action .two-line-2 {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Variant: Default (gray) */
.two-line-default {
  background: var(--ghost);
}

.two-line-default .two-line-1 {
  color: var(--ghost-text);
}

.two-line-default .two-line-2 {
  color: var(--text-secondary);
}

.two-line-default:hover {
  background: var(--ghost-hover);
}

.two-line-default:hover .two-line-1,
.two-line-default:hover .two-line-2 {
  color: var(--text-on-color);
}

/* Variant: Primary (dark navy - brand color) */
.two-line-primary {
  background: var(--blue-light);
}

.two-line-primary .two-line-1 {
  color: var(--primary);
}

.two-line-primary .two-line-2 {
  color: var(--blue-dark);
}

.two-line-primary:hover {
  background: var(--primary);
}

.two-line-primary:hover .two-line-1,
.two-line-primary:hover .two-line-2 {
  color: var(--text-on-color);
}

/* Variant: Secondary (light blue - info/navigation) */
.two-line-secondary {
  background: var(--secondary);
}

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

.two-line-secondary .two-line-2 {
  color: var(--cyan);
}

.two-line-secondary:hover {
  background: var(--secondary-hover);
}

.two-line-secondary:hover .two-line-1,
.two-line-secondary:hover .two-line-2 {
  color: var(--text-on-color);
}

/* Variant: Warning (orange/contrast - inverted like others) */
.two-line-warning {
  background: var(--contrast-light);
}

.two-line-warning .two-line-1 {
  color: var(--contrast-hover);
}

.two-line-warning .two-line-2 {
  color: var(--contrast);
}

.two-line-warning:hover {
  background: var(--contrast);
}

.two-line-warning:hover .two-line-1,
.two-line-warning:hover .two-line-2 {
  color: var(--text-on-color);
}

/* Variant: Error (red) */
.two-line-error {
  background: var(--red-light);
}

.two-line-error .two-line-1 {
  color: var(--red-dark);
}

.two-line-error .two-line-2 {
  color: var(--red);
}

.two-line-error:hover {
  background: var(--red-dark);
}

.two-line-error:hover .two-line-1,
.two-line-error:hover .two-line-2 {
  color: var(--text-on-color);
}

/* Variant: Success (green) */
.two-line-success {
  background: var(--green-light);
}

.two-line-success .two-line-1 {
  color: var(--green-dark);
}

.two-line-success .two-line-2 {
  color: var(--green);
}

.two-line-success:hover {
  background: var(--green-dark);
}

.two-line-success:hover .two-line-1,
.two-line-success:hover .two-line-2 {
  color: var(--text-on-color);
}

/* Variant: Disabled */
.two-line-disabled {
  background: var(--disabled-bg);
  cursor: not-allowed;
  pointer-events: none;
}

.two-line-disabled .two-line-1,
.two-line-disabled .two-line-2 {
  color: var(--disabled-text);
}

/* Variant: Display (non-interactive look) */
.two-line-display {
  background: var(--surface-alt);
  cursor: default;
}

.two-line-display .two-line-1 {
  color: var(--text-primary);
}

.two-line-display .two-line-2 {
  color: var(--text-secondary);
}

.two-line-display:hover {
  background: var(--surface-alt);
}

/* Tag Button */
.tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.tag-btn:hover {
  opacity: 0.85;
}

.tag-btn i {
  font-size: 14px;
}

.tag-btn-purple { background: var(--purple-light); color: var(--purple-dark); }
.tag-btn-cyan { background: var(--cyan-light); color: var(--cyan-dark); }
.tag-btn-green { background: var(--green-light); color: var(--green-dark); }
.tag-btn-orange { background: var(--orange-light); color: var(--orange-dark); }

/* ==========================================================================
   Tags
   ========================================================================== */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 12px;
  line-height: 16px;
}

.tag-purple { background: var(--purple-light); color: var(--purple-dark); }
.tag-violet { background: var(--violet-light); color: var(--violet-dark); }
.tag-lavender { background: var(--lavender-light); color: var(--lavender-dark); }
.tag-indigo { background: var(--indigo-light); color: var(--indigo-dark); }
.tag-blue { background: var(--blue-light); color: var(--blue-dark); }
.tag-cyan { background: var(--cyan-light); color: var(--cyan-dark); }
.tag-turquoise { background: var(--turquoise-light); color: var(--turquoise-dark); }
.tag-green { background: var(--green-light); color: var(--green-dark); }
.tag-lime { background: var(--lime-light); color: var(--lime-dark); }
.tag-gold { background: var(--gold-light); color: var(--gold-dark); }
.tag-orange { background: var(--orange-light); color: var(--orange-dark); }
.tag-red { background: var(--red-light); color: var(--red-dark); }

/* Dark mode tag variants */
[data-theme="dark"] .tag-purple { background: var(--purple-verydark); color: var(--purple-light); }
[data-theme="dark"] .tag-violet { background: var(--violet-verydark); color: var(--violet-light); }
[data-theme="dark"] .tag-lavender { background: var(--lavender-verydark); color: var(--lavender-light); }
[data-theme="dark"] .tag-indigo { background: var(--indigo-verydark); color: var(--indigo-light); }
[data-theme="dark"] .tag-blue { background: var(--blue-verydark); color: var(--blue-light); }
[data-theme="dark"] .tag-cyan { background: var(--cyan-verydark); color: var(--cyan-light); }
[data-theme="dark"] .tag-turquoise { background: var(--turquoise-verydark); color: var(--turquoise-light); }
[data-theme="dark"] .tag-green { background: var(--green-verydark); color: var(--green-light); }
[data-theme="dark"] .tag-lime { background: var(--lime-verydark); color: var(--lime-light); }
[data-theme="dark"] .tag-gold { background: var(--gold-verydark); color: var(--gold-light); }
[data-theme="dark"] .tag-orange { background: var(--orange-verydark); color: var(--orange-light); }
[data-theme="dark"] .tag-red { background: var(--red-verydark); color: var(--red-light); }

/* ==========================================================================
   Avatars
   ========================================================================== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-on-color);
  flex-shrink: 0;
}

.avatar-xs { min-width: 24px; }
.avatar-s  { min-width: 28px; }
.avatar-sm { min-width: 32px; }
.avatar-lg { min-width: 48px; }

.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-s  { width: 28px; height: 28px; font-size: 11px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }

.avatar-purple { background: var(--purple); }
.avatar-violet { background: var(--violet); }
.avatar-lavender { background: var(--lavender); }
.avatar-indigo { background: var(--indigo); }
.avatar-blue { background: var(--blue); }
.avatar-cyan { background: var(--cyan); }
.avatar-turquoise { background: var(--turquoise); }
.avatar-green { background: var(--green); }
.avatar-lime { background: var(--lime); }
.avatar-gold { background: var(--gold); }
.avatar-orange { background: var(--orange); }
.avatar-red { background: var(--red); }

/* User cell - compact avatar + name + role for table rows */
.user-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

a.user-cell:hover .user-cell-name {
  text-decoration: underline;
  color: var(--primary);
}

.user-cell-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-cell-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
}

.user-cell-role {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-secondary);
}

/* User cell popover — appears on hover, uses fixed positioning to escape overflow:hidden */
.user-cell-wrapper {
  position: relative;
  display: inline-flex;
}

.user-cell-popover {
  position: fixed;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  z-index: 1100;
  pointer-events: none;
  overflow: hidden;
}

/* Topbar-style header: grey background, name+role left, avatar right */
.user-cell-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-alt);
}

.user-cell-popover-info {
  min-width: 0;
}

.user-cell-popover-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.user-cell-popover-role {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-secondary);
}

/* Detail rows below header */
.user-cell-popover-details {
  padding: 10px 14px;
}

.user-cell-popover-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.user-cell-popover-row i {
  font-size: 14px;
  flex-shrink: 0;
}

/* ==========================================================================
   Snacks (solid avatar colors, white text, X button)
   ========================================================================== */

.snack {
  display: inline-flex;
  align-items: center;
  width: 300px;
  height: 42px;
  box-sizing: border-box;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 20px;
  overflow: hidden;
  color: var(--text-on-color);
}

.snack-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.snack-icon i {
  font-size: 18px;
}

.snack-text {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.snack-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 16px;
}

.snack-message {
  font-weight: 400;
  font-size: 12px;
  line-height: 14px;
}

.snack-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 6px;
  border: none;
  background: transparent;
  color: var(--text-on-color);
  opacity: 0.7;
  cursor: pointer;
  border-radius: var(--radius);
}

.snack-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.snack-close i {
  font-size: 16px;
}

/* Snack variants (solid avatar colors) */
.snack-success { background: var(--green); }
.snack-warning { background: var(--orange); }
.snack-error { background: var(--red); }
.snack-info { background: var(--cyan); }

/* ==========================================================================
   Toasts (dark bg, icon left, actions below)
   ========================================================================== */

.toast {
  display: flex;
  align-items: flex-start;
  width: 320px;
  box-sizing: border-box;
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text-on-color);
  font-size: 14px;
  line-height: 20px;
  padding: 12px;
  gap: 12px;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-icon i {
  font-size: 20px;
}

.toast-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.toast-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 18px;
}

.toast-message {
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  opacity: 0.85;
}

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

.toast-action {
  background: none;
  border: none;
  color: var(--blue-light);
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  text-decoration: none;
  display: inline-block;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-on-color);
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-on-color);
  opacity: 0.5;
  cursor: pointer;
  border-radius: var(--radius);
  flex-shrink: 0;
  margin: -4px -4px -4px 0;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.toast-close i {
  font-size: 16px;
}

/* Toast type colors (icon colors - one level darker than light) */
.toast-success .toast-icon { color: var(--green); }
.toast-warning .toast-icon { color: var(--orange); }
.toast-error .toast-icon { color: var(--red); }
.toast-info .toast-icon { color: var(--cyan); }
.toast-question .toast-icon { color: var(--lime); }

/* ==========================================================================
   Dropdown
   ========================================================================== */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 42px;
  box-sizing: border-box;
  background: var(--surface-alt);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  cursor: pointer;
}

.dropdown-toggle i {
  font-size: 16px;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 4px;
  min-width: 160px;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.dropdown-menu-inner {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown:hover .dropdown-toggle {
  background: var(--surface-hover);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--surface-hover);
}

.dropdown-item i {
  font-size: 16px;
  color: var(--text-secondary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
}

.dropdown-toggle.dropdown-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 32px;
  height: 32px;
  background: transparent;
}

.dropdown:hover .dropdown-toggle.dropdown-dots {
  background: var(--surface-alt);
}

.dropdown-menu-right {
  left: auto;
  right: 0;
}

/* Dots-style dropdowns use click, not hover — disable hover show */
.dropdown:has(.dropdown-dots):not(.dropdown-open):hover .dropdown-menu {
  opacity: 0;
  visibility: hidden;
}

/* Click-activated dropdown with fixed positioning — escapes overflow:hidden */
.dropdown.dropdown-open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  position: fixed;
  top: auto;
  left: auto;
  z-index: 1100;
}

/* ==========================================================================
   Tables (Accordion Style)
   ========================================================================== */

.accordion-table {
  width: 100%;
  font-size: 14px;
  line-height: 20px;
}

.accordion-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 80px;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.accordion-row {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.accordion-row:hover {
  background: var(--surface-hover);
}

.accordion-summary {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 80px;
  gap: 16px;
  padding: 6px 16px;
  align-items: center;
}

.accordion-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

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

.accordion-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
}

.accordion-expand:hover {
  background: var(--surface-alt);
}

.accordion-icon {
  font-size: 18px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.accordion-row.expanded .accordion-icon {
  transform: rotate(180deg);
}

.accordion-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.accordion-row.expanded .accordion-details {
  max-height: 200px;
  padding: 0 16px 16px 16px;
}

.accordion-details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.accordion-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.accordion-detail-label {
  font-weight: 300;
  font-size: 12px;
  color: var(--text-secondary);
}

.accordion-detail-value {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-primary);
}

.table-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Tab Bar
   ========================================================================== */

.tab-bar {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  gap: 4px;
}

.tab-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, padding 0.3s ease;
  overflow: hidden;
}

.tab-item i {
  font-size: 20px;
  flex-shrink: 0;
}

.tab-item .tab-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 500;
  font-size: 14px;
  margin-left: 0;
  transition: max-width 0.3s ease, opacity 0.2s ease, margin-left 0.3s ease;
}

.tab-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.tab-item:hover .tab-label {
  max-width: 120px;
  opacity: 1;
  margin-left: 8px;
}

.tab-item.active {
  background: var(--primary);
  color: var(--text-on-color);
}

.tab-item.active .tab-label {
  max-width: 120px;
  opacity: 1;
  margin-left: 8px;
}

/* ==========================================================================
   Checkbox
   ========================================================================== */

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

.checkbox input {
  display: none;
}

.checkbox-box {
  width: 20px;
  height: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.checkbox-box i {
  font-size: 14px;
  color: var(--text-on-color);
  opacity: 0;
  transition: opacity 0.2s;
}

.checkbox input:checked + .checkbox-box {
  background: var(--primary);
}

.checkbox input:checked + .checkbox-box i {
  opacity: 1;
}

.checkbox:hover .checkbox-box {
  background: var(--surface-hover);
}

.checkbox input:checked + .checkbox-box:hover {
  background: var(--secondary);
}

.checkbox-label {
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
}

.checkbox.checkbox-disabled {
  cursor: default;
  opacity: 0.5;
}

.checkbox.checkbox-disabled:hover .checkbox-box {
  background: var(--surface);
}

.checkbox.checkbox-disabled input:checked + .checkbox-box:hover {
  background: var(--primary);
}

/* ==========================================================================
   Toggle
   ========================================================================== */

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  display: none;
}

.toggle-track {
  position: relative;
  background: var(--surface);
  border-radius: 999px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-thumb {
  position: absolute;
  background: var(--disabled-text);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle input:checked + .toggle-track {
  background: var(--surface);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  background: var(--primary);
}

.toggle:hover .toggle-thumb {
  background: var(--text-secondary);
}

.toggle input:checked:hover + .toggle-track .toggle-thumb {
  background: var(--secondary);
}

.toggle-label {
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
}

/* Toggle Large */
.toggle-lg .toggle-track {
  width: 56px;
  height: 32px;
  padding: 4px;
}

.toggle-lg .toggle-thumb {
  width: 24px;
  height: 24px;
  top: 4px;
  left: 4px;
}

.toggle-lg input:checked + .toggle-track .toggle-thumb {
  transform: translateX(24px);
}

/* Toggle with Icons */
.toggle-icons .toggle-track {
  padding: 4px 8px;
}

.toggle-icons .toggle-icon {
  font-size: 14px;
  color: var(--text-secondary);
  z-index: 1;
  transition: color 0.2s;
}

.toggle-icons .toggle-icon-off {
  margin-right: 4px;
}

.toggle-icons .toggle-icon-on {
  margin-left: 4px;
}

.toggle-icons input:checked + .toggle-track .toggle-icon-on {
  color: var(--text-on-color);
}

.toggle-icons input:not(:checked) + .toggle-track .toggle-icon-off {
  color: var(--text-on-color);
}

/* Toggle XL (rectangular) */
.toggle-xl .toggle-track {
  width: 72px;
  height: 40px;
  padding: 4px;
  border-radius: var(--radius);
}

.toggle-xl .toggle-thumb {
  width: 32px;
  height: 32px;
  top: 4px;
  left: 4px;
  border-radius: var(--radius);
}

.toggle-xl input:checked + .toggle-track .toggle-thumb {
  transform: translateX(32px);
}

.toggle-xl .toggle-icon {
  font-size: 18px;
  width: 32px;
  text-align: center;
  margin: 0;
}

/* Toggle Square (for table row selection) */
.toggle-square .toggle-track {
  width: 56px;
  height: 32px;
  padding: 4px;
  border-radius: var(--radius);
}

.toggle-square .toggle-thumb {
  width: 24px;
  height: 24px;
  top: 4px;
  left: 4px;
  border-radius: var(--radius);
}

.toggle-square input:checked + .toggle-track .toggle-thumb {
  transform: translateX(24px);
}

.toggle-square .toggle-icon {
  font-size: 14px;
  width: 24px;
  text-align: center;
  margin: 0;
}

/* Selected row toggle - green */
.accordion-row .toggle input:checked + .toggle-track .toggle-thumb {
  background: var(--green);
}

/* Selected toggle on hover - red with tint */
.accordion-row .toggle:hover input:checked + .toggle-track {
  background: var(--red-light);
}

.accordion-row .toggle:hover input:checked + .toggle-track .toggle-thumb {
  background: var(--red);
}

/* ==========================================================================
   Form Controls
   ========================================================================== */

.form-control {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--secondary);
}

.form-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.form-select {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6e6c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-select:focus {
  outline: none;
  border-color: var(--secondary);
}

.form-textarea {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  resize: vertical;
  min-height: 100px;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--secondary);
}

.form-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
}

/* Search Input */
.search-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 320px;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.search-wrapper .search-input {
  padding-left: 36px;
}

/* ==========================================================================
   Sortable Table Headers
   ========================================================================== */

.sortable-header {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}

.sortable-header:hover {
  color: var(--primary);
}

.sortable-header.active {
  color: var(--primary);
  font-weight: 600;
}

.sortable-header i {
  font-size: 14px;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 16px 0;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

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

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

/* Superadmin visual distinction — red text + icons for elevated-privilege elements */
.superadmin-text { color: var(--red) !important; }
.superadmin-text .ti { color: var(--red) !important; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }
.gap-5 { gap: 40px; }

.w-full { width: 100%; }

/* ==========================================================================
   Labflow Breadcrumb (arrow-style stages)
   ========================================================================== */

.labflow-breadcrumb {
  display: inline-flex;
  align-items: center;
}

.labflow-stage {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 24px 0 28px;
  font-size: 14px;
  font-weight: 500;
  margin-right: -17px;
  min-width: 120px;
  background: var(--surface-alt);
  color: var(--text-secondary);
}

/* First stage - no left arrow indent */
.labflow-stage-first {
  padding-left: 16px;
  border-radius: var(--radius) 0 0 var(--radius);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 0 100%);
}

/* Middle stages - arrow on both sides */
.labflow-stage:not(.labflow-stage-first):not(.labflow-stage-last) {
  clip-path: polygon(20px 50%, 0 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 0 100%);
}

/* Last stage - arrow indent on left, straight on right */
.labflow-stage-last {
  padding-right: 16px;
  margin-right: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  clip-path: polygon(20px 50%, 0 0, 100% 0, 100% 100%, 0 100%);
}

/* First AND last (single stage) */
.labflow-stage-first.labflow-stage-last {
  clip-path: none;
  border-radius: var(--radius);
}

/* State colors */
.labflow-stage-completed {
  background: var(--primary);
  color: var(--text-on-color);
}

.labflow-stage-current {
  background: var(--primary);
  color: var(--text-on-color);
}

.labflow-stage-pending {
  background: var(--surface-alt);
  color: var(--disabled-text);
}

/* Content layout */
.labflow-stage-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  flex: 1;
}

.labflow-stage-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.labflow-stage-time {
  font-size: 10px;
  opacity: 0.75;
  line-height: 1.2;
  white-space: nowrap;
}

.labflow-stage-avatar {
  flex-shrink: 0;
  margin-left: 8px;
}

/* Simple pill-style labflow */
.labflow-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
}

.labflow-pill-completed {
  background: var(--green-light);
  color: var(--green-dark);
}

.labflow-pill-current {
  background: var(--primary);
  color: var(--text-on-color);
}

.labflow-pill-pending {
  background: var(--surface-alt);
  color: var(--disabled-text);
}

/* ==========================================================================
   Section Card - Chapter/Section wrapper with header
   ========================================================================== */

.section-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-card + .section-card,
.section-card + .cta-card,
.cta-card + .section-card {
  margin-top: 16px;
}

.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.section-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.section-card-actions {
  display: flex;
  gap: 8px;
}

.section-card-body {
  padding: 20px;
}

/* Section card with no body padding (for tables) */
.section-card-body:has(.data-table) {
  padding: 0;
}

.section-card-body:has(.data-table-wrapper) {
  padding: 0;
}

.section-card-body .data-table-wrapper {
  box-shadow: none;
  border-radius: 0;
}

/* Header Card - Compact title bar with optional actions, no body */
.header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.header-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.header-card-actions {
  display: flex;
  gap: 8px;
}

/* Detail Card - White header with primary text for entity details */
.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-card-title {
  padding: 6px 16px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}

.detail-card-body {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
}

.detail-card-body p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.detail-scrollable {
  max-height: 200px;
  overflow-y: auto;
}

/* Detail Fields - Label/Value pairs */
.detail-field {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.detail-label {
  color: var(--text-secondary);
  min-width: 115px;
  flex-shrink: 0;
  font-weight: 400;
}

.detail-value {
  font-weight: 400;
  color: var(--text-primary);
}

/* Entity Detail Header - Used on variant, sample, order detail pages */
.entity-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  gap: 8px;
}

.entity-detail-id {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entity-detail-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.entity-detail-subtitle {
  font-size: 13px;
  font-family: monospace;
  color: var(--text-secondary);
}

.entity-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Secondary Nav - Settings/Account sidebar menu
   ========================================================================== */

.secondary-nav {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  width: 220px;
  flex-shrink: 0;
}

.secondary-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.secondary-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.secondary-nav-item:not(.active):hover {
  background: var(--primary-light);
  color: var(--primary);
}

.secondary-nav-item.superadmin-text:not(.active):hover {
  background: var(--red-light);
  color: var(--red);
}

.secondary-nav-item.active {
  background: var(--primary);
  color: white;
}

.secondary-nav-item i {
  font-size: 18px;
}

/* Collapsible tier sections for settings sidebar */
.nav-tier {
}

.nav-tier-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 4px 0;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nav-tier-header:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-tier-header.superadmin-text:hover {
  background: var(--red-light);
  color: var(--red) !important;
}
.nav-tier-header i:first-child {
  font-size: 16px;
}

.nav-tier-chevron {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.15s ease;
}
.nav-tier.expanded .nav-tier-chevron {
  transform: rotate(90deg);
}

.nav-tier-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
}
.nav-tier.expanded .nav-tier-items {
  display: flex;
}

/* Indent nav items inside collapsible tiers */
.nav-tier .secondary-nav-item {
  padding: 8px 12px 8px 32px;
  font-size: 13px;
}
.nav-tier .secondary-nav-item i {
  font-size: 16px;
}

/* Settings page layout */
.settings-layout {
  display: flex;
  gap: 24px;
  width: 100%;
}
.settings-sidebar {
  flex-shrink: 0;
}
.settings-content {
  flex: 1;
  min-width: 0;
}

/* Detail grid layouts */
.detail-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.detail-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.detail-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 1024px) {
  .detail-grid-2,
  .detail-grid-3,
  .detail-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Dashboard Components
   ========================================================================== */

/* Dashboard Grids - Responsive columns */
.stat-grid,
.assignment-grid {
  display: grid;
  gap: 16px;
}

.stat-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.assignment-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Stat Card - Big number with label */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-secondary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Settings Card - Clickable link card for settings landing pages */
.settings-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.settings-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.settings-card > i {
  font-size: 28px;
  color: var(--primary);
  flex-shrink: 0;
}

.settings-card > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-card strong {
  font-size: 15px;
}

.settings-card span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Info Field - Key-value property cards for settings/detail pages */
.info-grid {
  display: grid;
  gap: 12px;
}

.info-field {
  position: relative;
  background: var(--surface-subtle);
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 0;
  overflow: hidden;
}

.info-field:hover {
  background: var(--surface-hover-alt);
}

a.info-field-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.info-field-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: 14px;
  flex-shrink: 0;
}

.info-field-badge {
  padding: 6px 12px;
  font-size: 12px;
  flex-shrink: 0;
}

.info-field-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 2px;
}

.info-field-label {
  flex: 1;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.info-field-value {
  display: block;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-field-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.15s, max-width 0.2s;
  position: relative;
  z-index: 1;
}

.info-field:hover .info-field-actions {
  opacity: 1;
  max-width: 150px;
}

.info-field-actions-visible {
  opacity: 1;
  max-width: 150px;
  margin-right: -4px;
}

.info-field-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.info-field-action:hover {
  color: var(--primary);
  background: var(--surface-alt);
}

.info-field-action-danger:hover {
  color: var(--red);
  background: var(--surface-alt);
}

.info-field-action.info-field-action-indicator {
  color: var(--text-secondary);
  font-size: 15px;
  width: 28px;
  height: 28px;
  background: var(--surface-alt);
  border-radius: 6px;
}

.info-field:hover .info-field-action-indicator {
  background: var(--surface-alt);
}

@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
  .info-field-actions {
    opacity: 1;
    max-width: 150px;
  }
}

/* Info Field - Dark mode — charcoal hover works in both themes */

/* Assignment Card - Clickable order card */
.assignment-card {
  display: block;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, transform 0.15s;
}

.assignment-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.assignment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.assignment-name {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.assignment-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.assignment-info {
  flex: 1;
}

.assignment-stage {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 2px;
}

.assignment-time {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Data Table - Simple table for lists */
.data-table-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-color);
}

/* First column (entity name) — 15% default */
.data-table th:first-child,
.data-table td:first-child {
  width: 15%;
}

/* All cells: prevent overflow with table-layout:fixed.
   max-width:0 forces cells to respect assigned column width. */
.data-table td {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}

/* Links/spans in any cell: block display for ellipsis to work.
   Exclude components that manage their own display. */
.data-table td > a:not(.user-cell):not(.btn),
.data-table td > span:not(.avatar):not(.tag):not(.tag-btn) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* user-cell inside table: flex (not inline-flex) to respect cell width */
.data-table .user-cell {
  display: flex;
  min-width: 0;
  white-space: normal;
}

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

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

/* Data Table - Expandable Rows */
.data-table-row-expandable {
  cursor: pointer;
  transition: background 0.15s ease;
}

.data-table-row-expandable:hover {
  background: var(--surface-hover);
}

.data-table-row-expandable.expanded {
  background: var(--surface-hover);
}

.data-table-row-details {
  display: none;
}

.data-table-row-details td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border-color);
}

.data-table-details-content {
  padding: 16px 24px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border-color);
}

.data-table-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: all 0.15s ease;
}

.data-table-expand-btn:hover {
  background: var(--surface-alt);
  color: var(--text-primary);
}

.data-table-expand-btn i {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.data-table-row-expandable.expanded .data-table-expand-btn i {
  transform: rotate(180deg);
}

/* Data Table - Sortable Headers */
.data-table-sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.data-table-sortable:hover {
  background: var(--surface-hover);
}

.data-table-sortable i {
  font-size: 12px;
  margin-left: 4px;
  opacity: 0.5;
  vertical-align: middle;
}

.data-table-sortable.active i {
  opacity: 1;
  color: var(--primary);
}

/* Data Table - Empty State */
.data-table-empty {
  text-align: center;
  padding: 48px 16px !important;
  color: var(--text-secondary);
}

.data-table-empty i {
  font-size: 2.5rem;
  opacity: 0.4;
  display: block;
  margin-bottom: 12px;
}

.data-table-empty p {
  margin: 0;
  font-size: 14px;
}

.data-table-empty-sub {
  margin-top: 4px !important;
  font-size: 13px !important;
  color: var(--text-secondary);
}

/* Data Table - Pagination */
.data-table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius) var(--radius);
}

.data-table-pagination-info {
  font-size: 14px;
  color: var(--text-secondary);
}

.data-table-pagination-pages {
  display: flex;
  gap: 4px;
}

.data-table-pagination-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.data-table-pagination-page:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.data-table-pagination-page.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-color);
  cursor: default;
  font-weight: 600;
}

.data-table-pagination-size {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

.data-table-pagination-size select {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

/* CTA Card - Call to action */
.cta-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.cta-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.cta-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.cta-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ==========================================================================
   Tab Navigation
   ========================================================================== */

.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: var(--radius);
  width: fit-content;
}

.tab-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.15s ease;
}

.tab-nav-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.tab-nav-item.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tab-nav-item i {
  font-size: 16px;
}

/* ==========================================================================
   Breadcrumb Path
   ========================================================================== */

.breadcrumb-path {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.breadcrumb-link {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

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

.parent-dir-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-color);
}

.parent-dir-link:hover {
  background: var(--surface-hover);
}

/* ==========================================================================
   Remote File List
   ========================================================================== */

.remote-file-row {
  display: grid;
  grid-template-columns: 1fr 80px auto 60px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

.remote-file-row:hover {
  background: var(--surface-hover);
}

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

.remote-file-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.remote-file-name i {
  font-size: 18px;
  color: var(--text-secondary);
}

.remote-file-name.folder i {
  color: var(--warning);
}

.remote-file-name a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}

.remote-file-name a:hover {
  color: var(--primary);
}

.remote-file-info {
  text-align: right;
}

.remote-file-size {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.remote-file-status {
  font-size: 11px;
  color: var(--text-secondary);
}

.remote-file-samples {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 13px;
  line-height: 1.2;
}

.remote-file-samples span {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-hover-alt);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-fill.success {
  background: var(--success);
}

.progress-fill.error {
  background: var(--error);
}

/* ==========================================================================
   Component Gallery Utilities
   ========================================================================== */

/* Section heading with accent border */
.section-heading {
  margin: 48px 0 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--heading-accent);
}

.section-heading:first-child {
  margin-top: 0;
}

/* Decorative component icon */
.component-icon {
  font-size: 32px;
  color: var(--heading-accent);
}

/* Code highlight in documentation */
.code-highlight {
  font-weight: 600;
  color: var(--code-highlight);
}

/* ==========================================================================
   Text Links (PubMed, external references)
   ========================================================================== */

.text-link,
a.text-link {
  color: var(--link);
  text-decoration: underline;
}

.text-link:hover,
a.text-link:hover {
  color: var(--link-hover);
}


/* ==========================================================================
   Frozen Table - Three-panel layout with synchronized scrolling
   ========================================================================== */

.frozen-table {
  display: flex;
  width: 100%;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.frozen-table-left {
  flex: 0 0 auto;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
}

.frozen-table-center {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;  /* Clip content to allocated width - inner scroll handles horizontal */
}

.frozen-table-right {
  flex: 0 0 auto;
  overflow: hidden;
  border-left: 1px solid var(--border-color);
}

/* Top scrollbar for horizontal scroll (visible above content) */
.frozen-table-top-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 17px;
  scrollbar-width: thin;
}

.frozen-table-top-scroll-spacer {
  height: 1px;
  width: 100%;
}

/* Scrollable content area */
.frozen-table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

/* Hide scrollbars on frozen columns */
.frozen-table-left,
.frozen-table-right {
  scrollbar-width: none;
}

.frozen-table-left::-webkit-scrollbar,
.frozen-table-right::-webkit-scrollbar {
  display: none;
}

/* Compact table styling for frozen tables */
.frozen-table table {
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.frozen-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.frozen-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.frozen-table tbody tr:hover {
  background: var(--surface-hover);
}

/* Sortable column headers */
.frozen-table th a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.frozen-table th a:hover {
  color: var(--primary);
}

/* Cell content truncation */
.frozen-table .cell-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   AMP/ASCO/CAP Tier Badges
   ========================================================================== */

.tier-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  text-transform: uppercase;
}

.tier-badge-1,
.tier-badge-1a,
.tier-badge-1b,
.tier-badge-1c,
.tier-badge-1d {
  background: var(--red-light);
  color: var(--red-dark);
}

.tier-badge-2,
.tier-badge-2c,
.tier-badge-2d {
  background: var(--orange-light);
  color: var(--orange-dark);
}

.tier-badge-3 {
  background: var(--gold-light);
  color: var(--gold-dark);
}

.tier-badge-4 {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

[data-theme="dark"] .tier-badge-1,
[data-theme="dark"] .tier-badge-1a,
[data-theme="dark"] .tier-badge-1b,
[data-theme="dark"] .tier-badge-1c,
[data-theme="dark"] .tier-badge-1d {
  background: var(--red-verydark);
  color: var(--red-light);
}

[data-theme="dark"] .tier-badge-2,
[data-theme="dark"] .tier-badge-2c,
[data-theme="dark"] .tier-badge-2d {
  background: var(--orange-verydark);
  color: var(--orange-light);
}

[data-theme="dark"] .tier-badge-3 {
  background: var(--gold-verydark);
  color: var(--gold-light);
}

[data-theme="dark"] .tier-badge-4 {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

/* ==========================================================================
   ACMG Classification Badges (Germline)
   ========================================================================== */

:root {
  /* ACMG 5-tier classification colors */
  --acmg-pathogenic: #d32f2f;
  --acmg-pathogenic-light: #ffebee;
  --acmg-likely-pathogenic: #f57c00;
  --acmg-likely-pathogenic-light: #fff3e0;
  --acmg-vus: #fbc02d;
  --acmg-vus-light: #fffde7;
  --acmg-likely-benign: #7cb342;
  --acmg-likely-benign-light: #f1f8e9;
  --acmg-benign: #388e3c;
  --acmg-benign-light: #e8f5e9;
}

.acmg-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  text-transform: uppercase;
}

.acmg-pathogenic {
  background: var(--acmg-pathogenic-light);
  color: var(--acmg-pathogenic);
}

.acmg-likely-pathogenic {
  background: var(--acmg-likely-pathogenic-light);
  color: var(--acmg-likely-pathogenic);
}

.acmg-vus {
  background: var(--acmg-vus-light);
  color: var(--acmg-vus);
}

.acmg-likely-benign {
  background: var(--acmg-likely-benign-light);
  color: var(--acmg-likely-benign);
}

.acmg-benign {
  background: var(--acmg-benign-light);
  color: var(--acmg-benign);
}

/* Medical significance colors — not themeable, hardcoded by design */
[data-theme="dark"] .acmg-pathogenic {
  background: #4a1c1c;
  color: #ef9a9a;
}

[data-theme="dark"] .acmg-likely-pathogenic {
  background: #4a2c14;
  color: #ffcc80;
}

[data-theme="dark"] .acmg-vus {
  background: #4a4014;
  color: #fff59d;
}

[data-theme="dark"] .acmg-likely-benign {
  background: #2a3c1c;
  color: #aed581;
}

[data-theme="dark"] .acmg-benign {
  background: #1b3a1b;
  color: #81c784;
}

/* ==========================================================================
   Button Variants - Square (no border-radius)
   ========================================================================== */

.btn-square {
  border-radius: 0;
}

.btn-square-sm {
  border-radius: 0;
  padding: 4px 8px;
  height: 24px;
  font-size: 11px;
}

/* ==========================================================================
   Tabs Component
   Grey container with white selected tab
   ========================================================================== */

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-alt);
  border-radius: var(--radius);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.5);
}

.tab.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--surface-alt);
  border-radius: 10px;
  color: var(--text-secondary);
}

.tab.active .tab-count {
  background: var(--primary-light);
  color: var(--primary);
}

[data-theme="dark"] .tabs {
  background: var(--surface-alt);
}

[data-theme="dark"] .tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .tab.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ========================================
   FLOATING ACTION BAR
   ======================================== */

.floating-action-bar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  z-index: 100;
  pointer-events: none;
}

.floating-action-bar-content {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

/* Style buttons in floating bar - elevated style */
.floating-action-bar .btn {
  border-radius: var(--radius);
  padding: 12px 24px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.floating-action-bar .btn-default {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.floating-action-bar .btn-default:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 3px 8px rgba(0, 0, 0, 0.2);
}

.floating-action-bar .btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  box-shadow: none;
}

.floating-action-bar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  box-shadow: none;
}

.floating-action-bar .btn-primary {
  background: var(--primary);
  border: none;
  color: var(--text-on-color);
  box-shadow: 0 4px 14px rgba(0, 40, 91, 0.4), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.floating-action-bar .btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 20px rgba(0, 40, 91, 0.5), 0 3px 8px rgba(0, 0, 0, 0.2);
}

.floating-action-bar .btn-primary:disabled {
  background: var(--disabled-text);
  color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  filter: none;
}

/* Add padding to content area to prevent content from being hidden behind floating bar */
.has-floating-actions {
  padding-bottom: 100px;
}
