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

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

:root {
  /* Primary & Secondary */
  --primary: #052d47;
  --secondary: #1f8aa2;

  /* 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;
  --pearl: #ebeae8;
  --silver: #dfdedd;
  --ash: #b0afad;
  --slate: #6f6e6c;
  --storm: #4b4a48;
  --charcoal: #363533;
  --obsidian: #232221;

  /* Semantic */
  --frame-bg: var(--silver);
  --body-bg: var(--snow);
  --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);

  /* 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);
  --primary: var(--blue);
  --secondary: var(--cyan-dark);
  --sidebar-bg: var(--frame-bg);
  --sidebar-text: var(--ash);
  --sidebar-text-hover: var(--white);
  --sidebar-selected-bg: var(--storm);
  --sidebar-selected-text: var(--white);
}

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

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

body {
  font-family: 'Manrope', sans-serif;
  background:
    /* Soft cyan wave - top right */
    radial-gradient(ellipse 120% 80% at 85% 15%, rgba(42, 185, 208, 0.06) 0%, transparent 50%),
    /* Deep blue wave - bottom left */
    radial-gradient(ellipse 100% 120% at 10% 90%, rgba(5, 45, 71, 0.05) 0%, transparent 45%),
    /* Turquoise glow - center left */
    radial-gradient(ellipse 80% 100% at 25% 50%, rgba(47, 210, 181, 0.04) 0%, transparent 40%),
    /* Cyan sweep - top left */
    radial-gradient(ellipse 90% 70% at 5% 20%, rgba(31, 138, 162, 0.05) 0%, transparent 50%),
    /* Warm highlight - center */
    radial-gradient(ellipse 60% 80% at 50% 40%, rgba(254, 254, 253, 0.5) 0%, transparent 50%),
    /* Blue tint - bottom right */
    radial-gradient(ellipse 100% 80% at 90% 80%, rgba(7, 102, 154, 0.04) 0%, transparent 45%),
    /* Purple hint - far right */
    radial-gradient(ellipse 50% 90% at 95% 50%, rgba(116, 74, 152, 0.03) 0%, transparent 40%),
    /* Base gradient */
    linear-gradient(135deg, rgba(252, 251, 250, 1) 0%, rgba(245, 244, 243, 0.8) 50%, rgba(248, 247, 246, 0.9) 100%);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background 0.3s, color 0.3s;
  overflow: hidden;
  height: 100vh;
}

/* ==========================================================================
   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(--white);
}

.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(--white);
  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(--blue-dark);
}

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

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

/* 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: 0;
  margin-bottom: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.topbar-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  height: 64px;
  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-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-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cyan);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.topbar-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--white);
  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-avatar.open .topbar-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.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(--snow);
}

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

/* ==========================================================================
   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: 24px;
  background: var(--body-bg);
  border-radius: var(--radius);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-lg);
  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(--white);
}

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

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

/* Audit Log - right side panel */
#audit-log {
  width: 280px;
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

.audit-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.audit-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.audit-text {
  font-size: 12px;
  color: var(--text-primary);
}

/* 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(--blue-dark);
  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(--white);
  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(--blue);
  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-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(--white);
}

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

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

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

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

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

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

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  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;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  filter: brightness(1);
  transition: box-shadow 2.5s ease, filter 2.5s ease;
}

.btn:hover {
  transition: box-shadow 0.15s ease, filter 0.15s 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);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--blue);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--white);
}

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

.btn-ghost:hover {
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--red);
  color: var(--white);
}

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

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

.btn-stacked {
  flex-direction: column;
  padding: 3px 24px 2px 24px;
  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;
}

/* 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;
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  color: var(--white);
}

.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.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); }

/* ==========================================================================
   Snacks (Toast Notifications)
   ========================================================================== */

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

.snack-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  color: var(--white);
  background: transparent;
}

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

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

.snack-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 16px;
  color: var(--white);
}

.snack-message {
  font-weight: 300;
  font-size: 14px;
  line-height: 16px;
  color: var(--white);
}

.snack-error { background: var(--red); }
.snack-warning { background: var(--gold); }
.snack-warning .snack-icon,
.snack-warning .snack-title,
.snack-warning .snack-message { color: var(--charcoal); }
.snack-info { background: var(--cyan); }
.snack-success { background: var(--lime); }
.snack-success .snack-icon,
.snack-success .snack-title,
.snack-success .snack-message { color: var(--charcoal); }

/* ==========================================================================
   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;
}

/* ==========================================================================
   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(--white);
}

.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(--white);
  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(--ash);
  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(--slate);
}

.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(--ash);
  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(--white);
}

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

/* 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;
}

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

.text-light { color: #ffffff; }
.text-dark { color: #212529; }

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

.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: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.w-full { width: 100%; }
