/* ============================================================
   SOLDIER MARKETING — Design System
   ShadCN-inspired, pure CSS, mobile-first, light/dark toggle
   ============================================================ */

/* ============================================================
   1. CSS VARIABLES — LIGHT THEME (DEFAULT)
   ============================================================ */
:root {
  /* Colors */
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --popover: #ffffff;
  --popover-foreground: #09090b;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #18181b;

  /* Success / Warning / Info extras */
  --success: #22c55e;
  --success-foreground: #ffffff;
  --success-bg: #f0fdf4;
  --warning: #f59e0b;
  --warning-foreground: #ffffff;
  --warning-bg: #fffbeb;
  --info: #3b82f6;
  --info-foreground: #ffffff;
  --info-bg: #eff6ff;
  --error-bg: #fef2f2;

  /* Layout */
  --radius: 0.5rem;
  --radius-sm: 0.25rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;
  --sidebar-width: 256px;
  --sidebar-collapsed-width: 64px;
  --topbar-height: 60px;

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-base: 150ms ease;
  --transition-slow: 300ms ease;

  /* Z-index scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-sidebar: 1030;
  --z-topbar: 1040;
  --z-modal-overlay: 1050;
  --z-modal: 1060;
  --z-toast: 1070;
}

/* ============================================================
   2. DARK THEME
   ============================================================ */
[data-theme="dark"] {
  --background: #09090b;
  --foreground: #fafafa;
  --card: #18181b;
  --card-foreground: #fafafa;
  --logo-filter: invert(1) brightness(2);
  --popover: #18181b;
  --popover-foreground: #fafafa;
  --primary: #fafafa;
  --primary-foreground: #18181b;
  --secondary: #27272a;
  --secondary-foreground: #fafafa;
  --muted: #27272a;
  --muted-foreground: #a1a1aa;
  --accent: #27272a;
  --accent-foreground: #fafafa;
  --destructive: #7f1d1d;
  --destructive-foreground: #fafafa;
  --border: #27272a;
  --input: #27272a;
  --ring: #d4d4d8;

  --success-bg: #052e16;
  --warning-bg: #451a03;
  --info-bg: #1e3a5f;
  --error-bg: #450a0a;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

/* ============================================================
   3. RESET & BASE STYLES
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--foreground);
  background-color: var(--background);
  transition: background-color var(--transition-slow), color var(--transition-slow);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  opacity: 0.8;
}

img, svg {
  display: block;
  max-width: 100%;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 600;
  color: var(--foreground);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  color: var(--foreground);
  line-height: 1.7;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--muted);
  color: var(--foreground);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  background-color: var(--muted);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
}

/* ============================================================
   4. LAYOUT — APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   5. SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background-color: #0a0a0a;
  border-right: 1px solid #222;
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: transform var(--transition-slow), width var(--transition-slow),
    background-color var(--transition-slow), border-color var(--transition-slow);
  overflow: hidden;
}

.sidebar--collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: var(--topbar-height);
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  transition: opacity var(--transition-slow), width var(--transition-slow);
}

.sidebar--collapsed .sidebar-logo-text {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.sidebar-collapse-btn i {
  transition: transform var(--transition-slow);
}

.sidebar--collapsed .sidebar-collapse-btn i {
  transform: rotate(180deg);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 2px;
}

.nav-group {
  margin-bottom: 1rem;
}

.nav-group-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  padding: 0 0.75rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-slow);
}

.sidebar--collapsed .nav-group-label {
  opacity: 0;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: color var(--transition-fast), background-color var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  color: var(--foreground);
  background-color: var(--accent);
  opacity: 1;
}

.nav-link.active {
  color: var(--foreground);
  background-color: var(--secondary);
  font-weight: 600;
}

.nav-link i {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-link-text {
  transition: opacity var(--transition-slow), width var(--transition-slow);
  overflow: hidden;
}

.sidebar--collapsed .nav-link-text {
  opacity: 0;
  width: 0;
}

.sidebar--collapsed .nav-link {
  justify-content: center;
  padding: 0.5rem;
}

/* Tooltip for collapsed sidebar */
.sidebar--collapsed .nav-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed-width) + 8px);
  background-color: var(--popover);
  color: var(--popover-foreground);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 100;
}

.sidebar--collapsed .nav-link:hover::after {
  opacity: 1;
}

.sidebar-footer {
  padding: 0.5rem;
  border-top: 1px solid #222;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  overflow: hidden;
}

.sidebar-user:hover {
  background-color: var(--accent);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  transition: opacity var(--transition-slow);
}

.sidebar-user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.sidebar--collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgb(0 0 0 / 0.5);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  transition: opacity var(--transition-slow);
}

/* ============================================================
   6. TOPBAR
   ============================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background-color: var(--background);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: var(--z-topbar);
  transition: left var(--transition-slow), background-color var(--transition-slow),
    border-color var(--transition-slow);
}

.sidebar--collapsed ~ .main-wrapper .topbar {
  left: var(--sidebar-collapsed-width);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.topbar-hamburger:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.breadcrumb-item a {
  color: var(--muted-foreground);
  transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--foreground);
  opacity: 1;
}

.breadcrumb-item.active {
  color: var(--foreground);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--border);
  font-size: 0.75rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  position: relative;
}

.topbar-icon-btn:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

/* ============================================================
   7. MAIN CONTENT AREA
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.sidebar--collapsed ~ .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

.main-content {
  margin-top: var(--topbar-height);
  padding: 1.5rem;
  flex: 1;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
}

.page-description {
  margin-top: 0.25rem;
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ============================================================
   8. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.25;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: background-color var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), box-shadow var(--transition-fast),
    opacity var(--transition-fast);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Secondary */
.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

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

/* Destructive */
.btn-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}

.btn-destructive:hover {
  opacity: 0.9;
}

/* Outline */
.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

.btn-outline:hover {
  background-color: var(--accent);
}

/* Danger */
.btn-danger {
  background-color: var(--destructive);
  color: #ffffff;
  border-color: var(--destructive);
}

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

/* Ghost */
.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
  border-color: transparent;
}

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

/* Link */
.btn-link {
  background-color: transparent;
  color: var(--primary);
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Sizes */
.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
  gap: 0.375rem;
}

.btn-lg {
  padding: 0.625rem 1.5rem;
  font-size: var(--font-size-base);
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

.btn-icon.btn-lg {
  width: 44px;
  height: 44px;
}

/* Loading state */
.btn--loading {
  pointer-events: none;
  position: relative;
}

.btn--loading .btn-text {
  opacity: 0;
}

.btn--loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ============================================================
   9. CARDS
   ============================================================ */
.card {
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-slow), border-color var(--transition-slow);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-header--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--card-foreground);
  line-height: 1.3;
}

.card-description {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  line-height: 1.5;
}

.card-content {
  padding: 1.5rem;
}

.card-footer {
  padding: 0 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-footer--between {
  justify-content: space-between;
}

/* ============================================================
   10. BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-default {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.badge-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 20%, transparent);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 20%, transparent);
}

.badge-error {
  background-color: var(--error-bg);
  color: var(--destructive);
  border-color: color-mix(in srgb, var(--destructive) 20%, transparent);
}

.badge-info {
  background-color: var(--info-bg);
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 20%, transparent);
}

.badge-muted {
  background-color: var(--muted);
  color: var(--muted-foreground);
}

.badge-outline {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

/* ============================================================
   11. FORM ELEMENTS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--foreground);
  line-height: 1.4;
}

.label--required::after {
  content: " *";
  color: var(--destructive);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  color: var(--foreground);
  background-color: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background-color var(--transition-slow);
  appearance: none;
  -webkit-appearance: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-foreground);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgb(from var(--ring) r g b / 0.15);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--muted);
}

.input--error,
.textarea--error,
.select--error {
  border-color: var(--destructive);
}

.input--error:focus,
.textarea--error:focus,
.select--error:focus {
  border-color: var(--destructive);
  box-shadow: 0 0 0 2px rgb(from var(--destructive) r g b / 0.15);
}

.textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' 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 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--destructive);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox {
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* Input with icon */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-left {
  position: absolute;
  left: 0.75rem;
  color: var(--muted-foreground);
  pointer-events: none;
  font-size: 0.875rem;
}

.input-icon-right {
  position: absolute;
  right: 0.75rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.input-wrapper .input--has-icon-left {
  padding-left: 2.25rem;
}

.input-wrapper .input--has-icon-right {
  padding-right: 2.25rem;
}

/* ============================================================
   12. TABLES
   ============================================================ */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table thead {
  background-color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.table td {
  padding: 0.875rem 1rem;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
  background-color: var(--muted);
}

.table tbody tr[data-href] {
  cursor: pointer;
}

.table--striped tbody tr:nth-child(even) {
  background-color: color-mix(in srgb, var(--muted) 50%, transparent);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* ============================================================
   13. MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgb(0 0 0 / 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-overlay);
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(-16px) scale(0.97);
  transition: transform var(--transition-base);
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal--sm { max-width: 380px; }
.modal--lg { max-width: 700px; }
.modal--xl { max-width: 900px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.modal-description {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.modal-close:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
   14. ALERTS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: var(--font-size-sm);
  position: relative;
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 1rem;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.alert-description {
  color: inherit;
  opacity: 0.9;
  line-height: 1.5;
}

.alert-dismiss {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.alert-dismiss:hover {
  opacity: 1;
}

.alert-success {
  background-color: var(--success-bg);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
  color: var(--success);
}

.alert-warning {
  background-color: var(--warning-bg);
  border-color: color-mix(in srgb, var(--warning) 25%, transparent);
  color: var(--warning);
}

.alert-error {
  background-color: var(--error-bg);
  border-color: color-mix(in srgb, var(--destructive) 25%, transparent);
  color: var(--destructive);
}

.alert-info {
  background-color: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 25%, transparent);
  color: var(--info);
}

/* ============================================================
   15. SPINNER
   ============================================================ */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--foreground);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

.spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.spinner--primary {
  border-color: color-mix(in srgb, var(--primary) 20%, transparent);
  border-top-color: var(--primary);
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  flex-direction: column;
  gap: 1rem;
}

.loading-text {
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
}

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

/* ============================================================
   16. PROGRESS BAR
   ============================================================ */
.progress {
  width: 100%;
  height: 8px;
  background-color: var(--muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.progress-bar--success { background-color: var(--success); }
.progress-bar--warning { background-color: var(--warning); }
.progress-bar--error   { background-color: var(--destructive); }
.progress-bar--info    { background-color: var(--info); }

.progress--sm { height: 4px; }
.progress--lg { height: 12px; }

/* ============================================================
   17. TABS
   ============================================================ */
.tabs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tab-list {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-list::-webkit-scrollbar {
  display: none;
}

.tab-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--muted-foreground);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  margin-bottom: -1px;
}

.tab-trigger:hover {
  color: var(--foreground);
}

.tab-trigger.active,
.tab-trigger[aria-selected="true"] {
  color: var(--foreground);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active,
.tab-content[aria-selected="true"] {
  display: block;
}

/* Pill tabs variant */
.tab-list--pills {
  border-bottom: none;
  gap: 0.25rem;
  background-color: var(--muted);
  padding: 0.25rem;
  border-radius: var(--radius);
  width: fit-content;
}

.tab-list--pills .tab-trigger {
  border-bottom: none;
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  padding: 0.375rem 0.75rem;
}

.tab-list--pills .tab-trigger.active {
  background-color: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   18. DROPDOWN
   ============================================================ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background-color: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  padding: 0.25rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transition: opacity var(--transition-base), transform var(--transition-base);
  transform-origin: top right;
}

.dropdown-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  font-size: var(--font-size-sm);
  color: var(--popover-foreground);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  text-decoration: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background-color: var(--accent);
  opacity: 1;
}

.dropdown-item--destructive {
  color: var(--destructive);
}

.dropdown-item--destructive:hover {
  background-color: var(--error-bg);
}

.dropdown-separator {
  height: 1px;
  background-color: var(--border);
  margin: 0.25rem 0;
}

.dropdown-label {
  padding: 0.375rem 0.625rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================
   19. SEPARATOR
   ============================================================ */
.separator {
  height: 1px;
  background-color: var(--border);
  border: none;
  margin: 0;
}

.separator--vertical {
  width: 1px;
  height: 100%;
  display: inline-block;
}

/* ============================================================
   20. SKELETON LOADER
   ============================================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--muted) 0%,
    color-mix(in srgb, var(--muted) 60%, var(--background)) 50%,
    var(--muted) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

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

.skeleton-text--sm { height: 0.75em; }
.skeleton-text--lg { height: 1.5em; }

.skeleton-circle {
  border-radius: var(--radius-full);
}

.skeleton-button {
  height: 36px;
  width: 100px;
}

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

/* ============================================================
   21. SEO GAUGE (Semi-circle speedometer)
   ============================================================ */
.seo-gauge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.seo-gauge-canvas {
  display: block;
  max-width: 200px;
  width: 100%;
}

.seo-gauge-score {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--foreground);
  line-height: 1;
  text-align: center;
}

.seo-gauge-label {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  text-align: center;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Static CSS-only gauge fallback */
.seo-gauge {
  position: relative;
  width: 160px;
  height: 80px;
  overflow: hidden;
}

.seo-gauge::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(
    var(--gauge-color, var(--success)) var(--gauge-angle, 0deg),
    var(--muted) 0deg 180deg,
    transparent 180deg
  );
  transform: rotate(180deg);
}

.seo-gauge::after {
  content: "";
  position: absolute;
  top: 20px;
  left: 20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background-color: var(--card);
}

.seo-gauge-value {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--font-size-xl);
  font-weight: 700;
  z-index: 1;
  color: var(--foreground);
}

/* ============================================================
   22. STAT CARDS
   ============================================================ */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.stat-card-label {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  font-weight: 500;
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background-color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  font-size: 1rem;
}

.stat-card-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.1;
}

.stat-card-trend {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.stat-card-trend--up {
  color: var(--success);
}

.stat-card-trend--down {
  color: var(--destructive);
}

.stat-card-trend--neutral {
  color: var(--muted-foreground);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* ============================================================
   23. CALENDAR GRID
   ============================================================ */
.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--card);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.calendar-title {
  font-weight: 600;
  font-size: var(--font-size-base);
}

.calendar-nav {
  display: flex;
  gap: 0.25rem;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background-color: var(--muted);
}

.calendar-weekday {
  padding: 0.5rem;
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
  min-height: 80px;
  padding: 0.5rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-xs);
  transition: background-color var(--transition-fast);
}

.calendar-day:nth-child(7n) {
  border-right: none;
}

.calendar-day:hover {
  background-color: var(--accent);
}

.calendar-day--empty {
  background-color: color-mix(in srgb, var(--muted) 40%, transparent);
}

.calendar-day--today .calendar-day-number {
  background-color: var(--primary);
  color: var(--primary-foreground);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day-number {
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.25rem;
  font-size: var(--font-size-xs);
}

.calendar-event {
  display: block;
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.calendar-event--publish {
  background-color: var(--info-bg);
  color: var(--info);
}

.calendar-event--draft {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.calendar-event--done {
  background-color: var(--success-bg);
  color: var(--success);
}

/* ============================================================
   24. TAG INPUT
   ============================================================ */
.tag-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background-color: var(--background);
  min-height: 42px;
  align-items: center;
  cursor: text;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.tag-input-container:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgb(from var(--ring) r g b / 0.15);
}

.tag-input-container--error {
  border-color: var(--destructive);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  white-space: nowrap;
  animation: tag-appear 0.15s ease;
}

.tag--duplicate {
  animation: tag-shake 0.3s ease;
  border-color: var(--destructive);
  color: var(--destructive);
}

.tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.tag-remove:hover {
  color: var(--destructive);
  background-color: var(--error-bg);
}

.tag-input-field {
  flex: 1;
  min-width: 120px;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--font-size-sm);
  color: var(--foreground);
  padding: 0.125rem 0;
}

.tag-input-field::placeholder {
  color: var(--muted-foreground);
}

@keyframes tag-appear {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@keyframes tag-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-4px); }
  60%       { transform: translateX(4px); }
}

/* ============================================================
   25. TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: var(--z-toast);
  max-width: 380px;
  width: calc(100vw - 2.5rem);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateX(calc(100% + 1.5rem));
  opacity: 0;
  transition: transform var(--transition-slow), opacity var(--transition-slow);
  cursor: pointer;
}

.toast.is-visible {
  transform: translateX(0);
  opacity: 1;
}

.toast.is-hiding {
  transform: translateX(calc(100% + 1.5rem));
  opacity: 0;
}

.toast-icon {
  flex-shrink: 0;
  font-size: 1rem;
  margin-top: 1px;
}

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

.toast-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.4;
}

.toast-message {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  margin-top: 0.125rem;
  line-height: 1.5;
}

.toast-dismiss {
  flex-shrink: 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.toast-dismiss:hover {
  opacity: 1;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius) var(--radius);
  animation: toast-progress linear forwards;
}

.toast--success {
  border-left: 3px solid var(--success);
}

.toast--success .toast-icon { color: var(--success); }
.toast--success .toast-progress { background-color: var(--success); }

.toast--warning {
  border-left: 3px solid var(--warning);
}

.toast--warning .toast-icon { color: var(--warning); }
.toast--warning .toast-progress { background-color: var(--warning); }

.toast--error {
  border-left: 3px solid var(--destructive);
}

.toast--error .toast-icon { color: var(--destructive); }
.toast--error .toast-progress { background-color: var(--destructive); }

.toast--info {
  border-left: 3px solid var(--info);
}

.toast--info .toast-icon { color: var(--info); }
.toast--info .toast-progress { background-color: var(--info); }

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ============================================================
   26. EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background-color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.empty-state-description {
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* ============================================================
   27. UTILITY CLASSES
   ============================================================ */

/* Text */
.text-xs  { font-size: var(--font-size-xs); }
.text-sm  { font-size: var(--font-size-sm); }
.text-base{ font-size: var(--font-size-base); }
.text-lg  { font-size: var(--font-size-lg); }
.text-xl  { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

.text-muted    { color: var(--muted-foreground); }
.text-primary  { color: var(--primary); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-error    { color: var(--destructive); }
.text-info     { color: var(--info); }

.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Layout */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.justify-center{ justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* Spacing */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-4  { padding: 1rem; }
.p-6  { padding: 1.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }

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

/* Width */
.w-full { width: 100%; }
.max-w-sm { max-width: 380px; }
.max-w-md { max-width: 500px; }
.max-w-lg { max-width: 700px; }

/* Rounded */
.rounded-sm  { border-radius: var(--radius-sm); }
.rounded     { border-radius: var(--radius); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-full{ border-radius: var(--radius-full); }

/* ============================================================
   28. DJANGO MESSAGES INTEGRATION
   ============================================================ */
.messages-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.django-message {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
}

.django-message.success {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}

.django-message.warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 25%, transparent);
}

.django-message.error {
  background-color: var(--error-bg);
  color: var(--destructive);
  border-color: color-mix(in srgb, var(--destructive) 25%, transparent);
}

.django-message.info {
  background-color: var(--info-bg);
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 25%, transparent);
}

.django-message .message-text {
  flex: 1;
}

/* ============================================================
   29. SEARCH BAR
   ============================================================ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 400px;
  width: 100%;
}

.search-bar .input {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: none;
}

.search-bar .btn {
  border-radius: 0 var(--radius) var(--radius) 0;
  flex-shrink: 0;
}

/* ============================================================
   30. PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--foreground);
  background-color: var(--background);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
}

.page-btn:hover {
  background-color: var(--accent);
  opacity: 1;
}

.page-btn.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   31. FILTERS BAR
   ============================================================ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.875rem 1rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.filter-chip.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.filter-chip:hover {
  background-color: var(--accent);
}

.filter-chip.active:hover {
  opacity: 0.9;
}

/* ============================================================
   32. RESPONSIVE — MOBILE FIRST
   ============================================================ */

/* Mobile: < 768px */
@media (max-width: 767px) {
  /* Sidebar becomes overlay */
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  /* Overlay backdrop */
  .sidebar-overlay {
    display: block;
  }

  .sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Topbar full width on mobile */
  .topbar {
    left: 0;
  }

  .topbar-hamburger {
    display: flex;
  }

  /* Main content full width */
  .main-wrapper {
    margin-left: 0;
  }

  .main-content {
    padding: 1rem;
  }

  /* Collapse sidebar collapse btn on mobile */
  .sidebar-collapse-btn {
    display: none;
  }

  /* Tables scroll on mobile */
  .table-container {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin: 0 -1rem;
    width: calc(100% + 2rem);
  }

  /* Grids collapse to 1 column on mobile */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Modals full screen on mobile */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
  }

  .modal-overlay.is-open .modal {
    transform: translateY(0);
  }

  /* Toast full width on mobile */
  .toast-container {
    left: 1rem;
    right: 1rem;
    max-width: none;
    width: auto;
  }

  /* Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Calendar day smaller */
  .calendar-day {
    min-height: 52px;
    padding: 0.25rem;
  }
}

/* Tablet: 768px - 1024px */
@media (min-width: 768px) and (max-width: 1023px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

/* Desktop: >= 1024px */
@media (min-width: 1024px) {
  .topbar-hamburger {
    display: none;
  }
}

/* Wide screens */
@media (min-width: 1400px) {
  .main-content {
    padding: 2rem 2.5rem;
  }
}

/* ============================================================
   33. PRINT STYLES
   ============================================================ */
@media print {
  .sidebar,
  .topbar,
  .toast-container,
  .btn,
  .sidebar-overlay {
    display: none !important;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .main-content {
    margin-top: 0;
    padding: 0;
  }
}

/* ============================================================
   34. SCROLLBAR GLOBAL
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

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

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

*::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

/* ============================================================
   35. FOCUS VISIBLE GLOBAL
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ============================================================
   36. SELECTION
   ============================================================ */
::selection {
  background-color: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--foreground);
}

/* ============================================================
   37. ANIMATION UTILITIES
   ============================================================ */
.animate-fade-in {
  animation: fade-in 0.2s ease forwards;
}

.animate-slide-up {
  animation: slide-up 0.2s ease forwards;
}

.animate-scale-in {
  animation: scale-in 0.15s ease forwards;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

@keyframes scale-in {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* ============================================================
   38. TEMPLATE COMPONENTS — Sites, Planning, Content
   ============================================================ */

/* ── Spin animation (sync buttons, loaders) ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner { animation: spin 0.7s linear infinite; display: inline-block; }

/* ── Page header layout ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-header-left  {}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}
.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  margin-top: 4px;
}

/* ── Cards grid ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ── Site card ── */
.site-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}
.site-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--ring);
}
.site-card-body {
  padding: 18px;
  flex: 1;
}
.site-card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--secondary);
  display: flex;
  gap: 6px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Stat cards ── */
.stat-card-value {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat-card-label {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ── Badges for status / SEO plugins ── */
.badge { display: inline-flex; align-items: center; gap: 4px; }

.badge-pending {
  background-color: var(--secondary);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}
.badge-ready {
  background-color: var(--success-bg);
  color: var(--success);
}
.badge-publishing {
  background-color: var(--warning-bg);
  color: var(--warning);
}
.badge-completed {
  background-color: var(--info-bg);
  color: var(--info);
}
.badge-draft {
  background-color: var(--secondary);
  color: var(--muted-foreground);
}
.badge-generated {
  background-color: var(--info-bg);
  color: var(--info);
}
.badge-yoast {
  background-color: #f3e8ff;
  color: #7e22ce;
}
[data-theme="dark"] .badge-yoast {
  background-color: #2e1065;
  color: #c4b5fd;
}
.badge-rankmath {
  background-color: #fff7ed;
  color: #ea580c;
}
[data-theme="dark"] .badge-rankmath {
  background-color: #431407;
  color: #fb923c;
}
.badge-seo-none {
  background-color: var(--secondary);
  color: var(--muted-foreground);
}

/* ── SEO score badge (inline table) ── */
.seo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 700;
}
.seo-badge-good   { background: var(--success-bg); color: var(--success); }
.seo-badge-medium { background: var(--warning-bg); color: var(--warning); }
.seo-badge-poor   { background: var(--error-bg);   color: var(--destructive); }

/* ── SEO checklist ── */
.seo-checklist { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.seo-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--font-size-xs);
  line-height: 1.5;
}
.seo-check-icon { flex-shrink: 0; font-size: 0.85rem; margin-top: 1px; }
.seo-check-icon.pass { color: var(--success); }
.seo-check-icon.fail { color: var(--destructive); }
.seo-check-text { color: var(--muted-foreground); }
.seo-check-text.pass { color: var(--foreground); }
.seo-check-tip {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  font-style: italic;
  margin-top: 2px;
}

/* ── SEO Gauge (canvas semi-circle) ── */
.seo-gauge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.seo-gauge-canvas { display: block; }
.seo-gauge-score {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.seo-gauge-label {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Buttons extra variants ── */
.btn-danger {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
  border: 1px solid var(--destructive);
}
.btn-danger:hover {
  background-color: color-mix(in srgb, var(--destructive) 90%, black);
  border-color: color-mix(in srgb, var(--destructive) 90%, black);
}
.btn-danger-outline {
  background: transparent;
  color: var(--destructive);
  border: 1px solid var(--destructive);
}
.btn-danger-outline:hover {
  background-color: var(--error-bg);
}
.btn-success {
  background-color: var(--success);
  color: var(--success-foreground);
  border: 1px solid var(--success);
}
.btn-success:hover {
  background-color: color-mix(in srgb, var(--success) 90%, black);
  border-color: color-mix(in srgb, var(--success) 90%, black);
}
.btn-info-outline {
  background: transparent;
  color: var(--info);
  border: 1px solid var(--info);
}
.btn-info-outline:hover {
  background-color: var(--info-bg);
}
.w-full { width: 100%; }
.flex-1 { flex: 1; }

/* ── Alerts ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  margin-bottom: 14px;
}
.alert-success { background: var(--success-bg); border-color: #bbf7d0; color: #14532d; }
.alert-danger  { background: var(--error-bg);   border-color: #fecaca; color: #7f1d1d; }
.alert-warning { background: var(--warning-bg); border-color: #fde68a; color: #78350f; }
.alert-info    { background: var(--info-bg);    border-color: #bae6fd; color: #0c4a6e; }
[data-theme="dark"] .alert-success { color: #86efac; border-color: #166534; }
[data-theme="dark"] .alert-danger  { color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .alert-warning { color: #fcd34d; border-color: #78350f; }
[data-theme="dark"] .alert-info    { color: #7dd3fc; border-color: #0c4a6e; }
.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  font-size: 1rem;
  flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }

/* ── Filters bar ── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--secondary);
  margin-bottom: 16px;
}
.search-input-wrapper {
  position: relative;
  flex: 2;
  min-width: 180px;
}
.search-input-wrapper > i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
  pointer-events: none;
}
.search-input-wrapper .form-input { padding-left: 32px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--foreground); }
.tab-btn.active {
  color: var(--foreground);
  border-bottom-color: var(--foreground);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Progress bar ── */
.progress-bar-wrapper {
  background: var(--secondary);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.3s ease;
}
.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }

/* ── Token display ── */
.token-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.token-display code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  word-break: break-all;
}

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--foreground);
}
.form-label-required::after { content: ' *'; color: var(--destructive); }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 15%, transparent);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--muted-foreground); }
.form-input.is-invalid,
.form-textarea.is-invalid,
.form-select.is-invalid {
  border-color: var(--destructive);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-select { appearance: auto; cursor: pointer; }
.form-hint  { font-size: var(--font-size-xs); color: var(--muted-foreground); }
.form-error { font-size: var(--font-size-xs); color: var(--destructive); font-weight: 500; display:block; margin-top:4px; }

/* Campo com erro — borda vermelha automática via :has() */
.form-group:has(.form-error) .form-input,
.form-group:has(.form-error) input,
.form-group:has(.form-error) textarea,
.form-group:has(.form-error) select {
  border-color: var(--destructive) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
  outline-color: var(--destructive);
}

/* Input group */
.input-group { display: flex; align-items: stretch; }
.input-group .form-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  flex: 1;
}
.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: none;
}

/* Toggle switch */
.toggle-wrapper { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  display: inline-block;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--input);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
}
.toggle input:checked ~ .toggle-track { background: var(--primary); }
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }

/* Char counter */
.char-counter { font-size: var(--font-size-xs); color: var(--muted-foreground); text-align: right; }
.char-counter.warn { color: var(--warning); }
.char-counter.over { color: var(--destructive); }

/* ── Data Table ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  background: var(--card);
}
table.data-table thead tr {
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}
table.data-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  white-space: nowrap;
}
table.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}
table.data-table tbody tr:last-child { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--secondary); }
table.data-table tbody td { padding: 10px 14px; vertical-align: middle; }

/* ── Satellite topic table ── */
.satellite-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-xs);
  background: var(--card);
}
.satellite-table th {
  padding: 8px 10px;
  font-weight: 600;
  text-align: left;
  color: var(--muted-foreground);
  background: var(--secondary);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.satellite-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.satellite-table tr:hover td { background: var(--secondary); }

/* ── Pillar card ── */
.pillar-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--card);
  transition: box-shadow var(--transition-base);
}
.pillar-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.pillar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border-left: 3px solid var(--primary);
  cursor: pointer;
  user-select: none;
}
.pillar-header:hover {
  background: var(--secondary);
}
.pillar-card.collapsed .pillar-header {
  border-bottom: none;
}
.pillar-card:not(.collapsed) .pillar-header {
  border-bottom: 1px solid var(--border);
}
.pillar-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  flex: 1;
  color: var(--foreground);
}
.pillar-chevron {
  transition: transform var(--transition-base);
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.pillar-card.collapsed .pillar-chevron { transform: rotate(-90deg); }
.pillar-card.collapsed .pillar-body { display: none; }

/* ── Empty state ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  gap: 10px;
}
.empty-state-icon {
  font-size: 3.5rem;
  color: var(--muted-foreground);
  opacity: 0.4;
  margin-bottom: 4px;
}
.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}
.empty-state-description {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  max-width: 360px;
  margin: 0;
}

/* ── Modals ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-backdrop .modal {
  transform: scale(0.95);
  transition: transform var(--transition-base);
}
.modal-backdrop.open .modal { transform: scale(1); }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 20px 0 0;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--card);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.page-link:hover {
  background: var(--secondary);
  color: var(--foreground);
  opacity: 1;
}
.page-link.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.page-link.disabled { opacity: 0.4; pointer-events: none; cursor: default; }

/* ── Content editor layout ── */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  flex-wrap: wrap;
}
.editor-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.editor-toolbar-btn:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.editor-toolbar-btn.is-active {
  background: var(--secondary);
  color: var(--foreground);
  font-weight: 700;
}
.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}
#tiptap-editor {
  border: none;
  min-height: 480px;
  padding: 20px;
  outline: none;
  font-size: var(--font-size-base);
  line-height: 1.8;
  color: var(--foreground);
  background: var(--card);
}
#tiptap-editor h2 { font-size: 1.4rem; font-weight: 700; margin: 20px 0 8px; }
#tiptap-editor h3 { font-size: 1.15rem; font-weight: 600; margin: 16px 0 6px; }
#tiptap-editor ul, #tiptap-editor ol { padding-left: 24px; margin: 10px 0; }
#tiptap-editor blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 14px;
  color: var(--muted-foreground);
  margin: 14px 0;
  font-style: italic;
}
#tiptap-editor code { background: var(--muted); padding: 2px 5px; border-radius: var(--radius-sm); }
#tiptap-editor a { color: var(--primary); text-decoration: underline; }

/* ── FAQ items ── */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--card);
}
.faq-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--secondary);
  font-weight: 500;
  font-size: var(--font-size-sm);
}
.faq-item-body { padding: 10px 12px; font-size: var(--font-size-sm); color: var(--muted-foreground); }
.faq-remove {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted-foreground);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}
.faq-remove:hover { color: var(--destructive); }

/* ── Featured image ── */
.featured-image-preview {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--muted);
  display: block;
}
.featured-image-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  background: var(--secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  gap: 6px;
  font-size: var(--font-size-xs);
}

/* ── Internal link suggestions ── */
.link-suggestion {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--font-size-xs);
  margin-bottom: 6px;
  background: var(--secondary);
  transition: border-color var(--transition-fast);
}
.link-suggestion:hover { border-color: var(--ring); }
.link-suggestion-title { font-weight: 500; color: var(--foreground); }
.link-suggestion-kw   { color: var(--muted-foreground); }

/* ── Auto-save indicator ── */
.save-indicator {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.3s;
}
.save-indicator.saved  { color: var(--success); }
.save-indicator.saving { color: var(--warning); }
.save-indicator.error  { color: var(--destructive); }

/* ── Code / token block ── */
.code-block {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  word-break: break-all;
}

/* ── Divider utility ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ── Flex utilities ── */
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ── Text utilities ── */
.text-xs  { font-size: var(--font-size-xs); }
.text-sm  { font-size: var(--font-size-sm); }
.text-xl  { font-size: var(--font-size-xl); }
.text-secondary { color: var(--muted-foreground); }
.fw-medium  { font-weight: 500; }
.fw-semibold{ font-weight: 600; }
.fw-bold    { font-weight: 700; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all  { word-break: break-all; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

/* ============================================================
   38. BASE TEMPLATE CLASS ALIASES
   These map the actual class names used in base.html to the
   design system styles defined above.
   ============================================================ */

/* Layout body wrapper (replaces .main-wrapper in the template) */
.layout-body {
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

/* Sidebar brand / logo block */
.sidebar-logo {
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 1.25rem;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--foreground);
  font-weight: 700;
  font-size: var(--font-size-base);
  line-height: 1.2;
  overflow: hidden;
}

.sidebar-brand:hover {
  opacity: 1;
  color: var(--foreground);
}

.sidebar-brand-icon {
  width: 34px;
  height: 34px;
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-text {
  white-space: nowrap;
  overflow: hidden;
  font-size: var(--font-size-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}

.sidebar-brand-text small {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--muted-foreground);
  letter-spacing: 0.08em;
}

/* Sidebar nav menu */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-item {
  /* wrapper — no styles needed */
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.55);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.sidebar-link:hover {
  color: #fff;
  background-color: rgba(255,255,255,0.08);
  opacity: 1;
}

.sidebar-link.active {
  color: #fff;
  background-color: rgba(255,255,255,0.12);
  font-weight: 600;
}

.sidebar-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.sidebar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Separator inside sidebar nav */
.sidebar-separator {
  height: 1px;
  background-color: #222;
  margin: 0.5rem 0.75rem;
}

.sidebar-section-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.25rem;
}

/* Sidebar footer user area */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color var(--transition-fast);
  flex: 1;
  overflow: hidden;
}

.sidebar-user:hover {
  background-color: rgba(255,255,255,0.08);
  opacity: 1;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-avatar-initials {
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--font-size-xs);
  color: rgba(255,255,255,0.4);
  margin-top: 1px;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  flex-shrink: 0;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.sidebar-logout:hover {
  color: var(--destructive);
  background-color: var(--error-bg);
  opacity: 1;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Topbar template classes */
.topbar-breadcrumb {
  /* alias for .breadcrumb */
}

.topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.topbar-btn:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

/* Theme icons inside topbar button */
.topbar-btn .theme-icon-dark { display: none; }
.topbar-btn .theme-icon-light { display: block; }

[data-theme="dark"] .topbar-btn .theme-icon-light { display: none; }
[data-theme="dark"] .topbar-btn .theme-icon-dark  { display: block; }

/* User dropdown in topbar */
.topbar-user-dropdown {
  position: relative;
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  color: var(--foreground);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.topbar-user-btn:hover {
  background-color: var(--accent);
}

.topbar-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background-color: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  padding: 0.25rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transition: opacity var(--transition-base), transform var(--transition-base);
  transform-origin: top right;
}

.topbar-dropdown-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

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

.dropdown-item-danger {
  color: var(--destructive) !important;
}

.dropdown-item-danger:hover {
  background-color: var(--error-bg) !important;
}

/* Badge aliases */
.badge-admin {
  background-color: var(--info-bg);
  color: var(--info);
  border: 1px solid color-mix(in srgb, var(--info) 20%, transparent);
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-user {
  background-color: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgb(0 0 0 / 0.5);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.sidebar-overlay.visible,
.sidebar-overlay.is-open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* sidebar-open class used by template's inline toggle */
.sidebar.sidebar-open {
  transform: translateX(0) !important;
  box-shadow: var(--shadow-xl);
}

/* Mobile layout adjustments */
@media (max-width: 767px) {
  .layout-body {
    margin-left: 0;
  }

  .topbar-user-name {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: var(--z-sidebar);
  }
}

/* ============================================================
   39. TOPBAR HAMBURGER RESPONSIVE
   ============================================================ */
.topbar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.topbar-hamburger:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

@media (max-width: 767px) {
  .topbar-hamburger {
    display: flex;
  }
}

/* ============================================================
   40. REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

/* ============================================================
   41. TEMPLATE COMPONENT EXTENSIONS
   Additional classes used in training, publishing, reports
   and admin templates.
   ============================================================ */

/* ── stat-card inner classes (shorthand aliases) ─────────── */
.stat-card .stat-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.stat-card .stat-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--foreground);
}

.stat-card .stat-sub {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.stat-card .stat-icon {
  font-size: 1.25rem;
  margin-bottom: 0.125rem;
}

/* ── stats-row grid ──────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── card-grid ───────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* ── table-wrapper ───────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--card);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table-wrapper thead th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  background-color: var(--muted);
  white-space: nowrap;
}

.table-wrapper tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-fast);
}

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

.table-wrapper tbody tr:hover {
  background-color: color-mix(in srgb, var(--muted) 60%, transparent);
}

.table-wrapper tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.table-wrapper tfoot td {
  padding: 0.625rem 1rem;
  background-color: var(--muted);
}

.td-actions {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  white-space: nowrap;
}

/* ── Status dots ─────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-published  { background-color: var(--success); }
.status-dot-queued     { background-color: var(--info); }
.status-dot-generating { background-color: var(--warning); }
.status-dot-error      { background-color: var(--destructive); }
.status-dot-retry      { background-color: #f97316; }
.status-dot-cancelled  { background-color: var(--muted-foreground); }
.status-dot-draft      { background-color: #a1a1aa; }
.status-dot-pending    { background-color: #f97316; }
.status-dot-scheduled  { background-color: #8b5cf6; }

/* ── Badge extra aliases ─────────────────────────────────── */
.badge-active,
.badge-published {
  background-color: var(--success-bg);
  color: #166534;
}

.badge-queued {
  background-color: var(--info-bg);
  color: #1e40af;
}

.badge-generating {
  background-color: var(--warning-bg);
  color: #92400e;
}

.badge-retry,
.badge-orange {
  background-color: #fff7ed;
  color: #9a3412;
}

.badge-inactive {
  background-color: var(--muted);
  color: var(--muted-foreground);
}

[data-theme="dark"] .badge-active,
[data-theme="dark"] .badge-published {
  background-color: #052e16;
  color: #86efac;
}

[data-theme="dark"] .badge-queued {
  background-color: var(--info-bg);
  color: #93c5fd;
}

[data-theme="dark"] .badge-generating {
  background-color: var(--warning-bg);
  color: #fde047;
}

[data-theme="dark"] .badge-retry {
  background-color: #431407;
  color: #fdba74;
}

[data-theme="dark"] .badge-inactive {
  background-color: var(--muted);
  color: var(--muted-foreground);
}

/* ── Filters bar ─────────────────────────────────────────── */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  padding: 1rem 1.25rem;
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
}

.filters-bar .filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 130px;
}

.filters-bar .filter-group label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.filters-bar select,
.filters-bar input[type="date"],
.filters-bar input[type="text"] {
  font-size: var(--font-size-sm);
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  color: var(--foreground);
  outline: none;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.filters-bar select:focus,
.filters-bar input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 20%, transparent);
}

/* ── Timeline ────────────────────────────────────────────── */
.timeline {
  list-style: none;
  position: relative;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background-color: var(--border);
  z-index: 0;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  z-index: 1;
  border: 2px solid var(--background);
}

.timeline-dot-success  { background-color: var(--success); color: #fff; }
.timeline-dot-error    { background-color: var(--destructive); color: #fff; }
.timeline-dot-warning  { background-color: var(--warning); color: #fff; }
.timeline-dot-info     { background-color: var(--info); color: #fff; }
.timeline-dot-muted    { background-color: var(--muted-foreground); color: #fff; }

.timeline-content {
  flex: 1;
  padding-top: 0.1rem;
}

.tl-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tl-event {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.tl-time {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.tl-detail {
  font-size: 0.8rem;
  margin-top: 0.375rem;
}

/* ── JSON detail panel ───────────────────────────────────── */
.json-detail {
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  overflow: auto;
  max-height: 220px;
}

.json-detail pre {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--foreground);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.btn-toggle-json {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--muted-foreground);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 0.25rem;
  font-family: inherit;
}

.btn-toggle-json:hover { color: var(--foreground); }

/* ── Editorial calendar (cal-* classes) ─────────────────── */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.cal-nav h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  min-width: 200px;
  text-align: center;
  letter-spacing: -0.02em;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--card);
}

.cal-dow {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  background-color: var(--muted);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.cal-dow:last-child { border-right: none; }

.cal-cell {
  min-height: 90px;
  padding: 0.375rem 0.5rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background-color: var(--card);
  vertical-align: top;
  transition: background-color var(--transition-fast);
}

.cal-cell:nth-child(7n) { border-right: none; }

.cal-cell:hover { background-color: color-mix(in srgb, var(--accent) 60%, transparent); }

.cal-cell.other-month {
  background-color: color-mix(in srgb, var(--muted) 40%, transparent);
  opacity: 0.65;
}

.cal-cell.today {
  background-color: color-mix(in srgb, var(--primary) 5%, var(--background));
}

.cal-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
  line-height: 1;
}

.cal-cell.today .cal-date {
  color: var(--primary-foreground);
  background-color: var(--primary);
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-article {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  margin-bottom: 2px;
  color: var(--foreground);
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
}

.cal-article:hover {
  background-color: var(--accent);
  text-decoration: none;
  opacity: 1;
}

.cal-article-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* ── Month selector ─────────────────────────────────────── */
.month-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.month-selector .month-label {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  min-width: 180px;
  text-align: center;
  letter-spacing: -0.02em;
}

/* ── Mini calendar (reports dashboard) ──────────────────── */
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 0.7rem;
}

.mini-cal-dow {
  text-align: center;
  font-weight: 600;
  color: var(--muted-foreground);
  padding: 0.2rem;
  font-size: 0.65rem;
}

.mini-cal-cell {
  text-align: center;
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-weight: 500;
}

.mini-cal-cell.has-posts {
  color: var(--foreground);
  font-weight: 700;
}

.mini-cal-cell.today-mini {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-radius: 50%;
}

.post-dots {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 1px;
}

.post-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--success);
  display: inline-block;
}

/* ── Report two-column layout ───────────────────────────── */
.report-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .report-cols { grid-template-columns: 1fr; }
}

/* ── Admin dashboard two-column layout ──────────────────── */
.admin-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .admin-cols { grid-template-columns: 1fr; }
}

/* ── Quick links strip ───────────────────────────────────── */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── Content prose block (training detail) ──────────────── */
.content-prose {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--foreground);
}

/* ── Word counter ────────────────────────────────────────── */
.word-counter {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.word-counter .wc-num {
  font-weight: 700;
  color: var(--foreground);
}

/* ── Large textarea for content editing ─────────────────── */
textarea.form-control-lg {
  min-height: 320px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}

.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

/* ── Empty state (card variant) ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted-foreground);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.35;
}

.empty-state h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: var(--font-size-sm);
  max-width: 420px;
  margin: 0 auto 1.5rem;
  color: var(--muted-foreground);
}

/* ── Chart container ─────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

/* ── Utility helpers used in templates ───────────────────── */
.justify-between { justify-content: space-between; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.flex-col        { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.flex-1          { flex: 1; }
.min-w-0         { min-width: 0; }

.text-xl  { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }

.text-right  { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-center { text-align: center; }

.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.d-block      { display: block; }
.d-flex       { display: flex; }
.d-inline-flex{ display: inline-flex; }
.d-none       { display: none; }

.w-full { width: 100%; }
.ms-auto { margin-left: auto; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }

.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }

.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }

.rounded-full { border-radius: 9999px; }

/* ── Responsive calendar ─────────────────────────────────── */
@media (max-width: 768px) {
  .cal-cell { min-height: 60px; padding: 0.25rem; }
  .cal-article { font-size: 0.65rem; }
  .cal-nav h2 { min-width: 160px; font-size: var(--font-size-lg); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
}

/* ============================================================
   42. TEMPLATE-LEVEL COMPONENT STYLES
   Classes used by the generated HTML templates.
   ============================================================ */

/* ── Login page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--background);
  padding: 1.5rem;
  position: relative;
}

.login-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.login-card {
  width: 100%;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background: #0a0a0a;
  padding: 2rem 2rem 1.75rem;
  margin-bottom: 0;
}

.login-brand-icon {
  width: 48px;
  height: 48px;
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand-name {
  font-size: var(--font-size-xl);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  margin: 0;
}

.login-brand-sub {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  text-transform: uppercase;
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
}

.login-footer {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  text-align: center;
}

.login-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
  z-index: 10;
}

.login-theme-toggle:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.login-theme-toggle .theme-icon-dark { display: none; }
.login-theme-toggle .theme-icon-light { display: block; }
[data-theme="dark"] .login-theme-toggle .theme-icon-light { display: none; }
[data-theme="dark"] .login-theme-toggle .theme-icon-dark  { display: block; }

/* ── Form aliases (Django form.control → design system) ──── */
.form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--foreground);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.form-input,
.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  color: var(--foreground);
  background-color: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-control:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 15%, transparent);
}

.form-input.input-error,
.form-control.input-error {
  border-color: var(--destructive);
}

.form-select,
select.form-control {
  width: 100%;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  color: var(--foreground);
  background-color: var(--background);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' 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 0.75rem center;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-select:focus,
select.form-control:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 15%, transparent);
}

.form-help {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.form-help-success {
  color: var(--success);
}

.form-required {
  color: var(--destructive);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-separator {
  height: 1px;
  background-color: var(--border);
  margin: 1.25rem 0;
}

.form-section-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.form-actions-sticky {
  position: sticky;
  bottom: 0;
  background-color: var(--background);
  padding: 0.75rem 0;
  z-index: var(--z-sticky);
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
}

.form-group-checkbox {
  justify-content: flex-end;
  padding-top: 1.5rem;
}

.form-group-inline {
  flex-direction: row;
  align-items: center;
}

/* ── Checkbox custom ──────────────────────────────────────── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--foreground);
  user-select: none;
}

.checkbox-input {
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.checkbox-custom {
  /* When using a pure CSS custom checkbox, this is the visual element */
}

/* ── Input with icon ─────────────────────────────────────── */
.input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input-with-icon {
  padding-left: 2.375rem;
}

.input-with-icon-right {
  padding-right: 2.5rem;
}

.input-icon-right {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  background: none;
  border: none;
  padding: 0.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.input-icon-right:hover {
  color: var(--foreground);
}

.password-toggle {
  color: var(--muted-foreground);
}

/* ── Buttons extras ─────────────────────────────────────── */
.btn-full {
  width: 100%;
}

.btn-danger-ghost {
  color: var(--destructive);
}

.btn-danger-ghost:hover {
  background-color: var(--error-bg);
  color: var(--destructive);
}

.btn-with-spinner {
  position: relative;
}

.btn-spinner {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.spinner {
  animation: spin 0.8s linear infinite;
}

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

/* ── Alert aliases ─────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
}

.alert-error {
  background-color: var(--error-bg);
  border-color: color-mix(in srgb, var(--destructive) 20%, transparent);
  color: var(--destructive);
}

.alert-success {
  background-color: var(--success-bg);
  border-color: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--success);
}

.alert-warning {
  background-color: var(--warning-bg);
  border-color: color-mix(in srgb, var(--warning) 20%, transparent);
  color: var(--warning);
}

.alert-info {
  background-color: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 20%, transparent);
  color: var(--info);
}

/* ── Page header layout ─────────────────────────────────── */
.page-header-info {
  flex: 1;
  min-width: 0;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Card extras ─────────────────────────────────────────── */
.card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.card-body-flush {
  padding: 0;
}

.card-body-centered {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.card-subtitle {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.card-badge {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  background-color: var(--muted);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
}

.card-link {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

.card-link:hover {
  color: var(--foreground);
  opacity: 1;
}

.card-header {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-header-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 0.25rem;
}

.card-header-icon-blue {
  background-color: var(--info-bg);
  color: var(--info);
}

.card-header-icon-purple {
  background-color: color-mix(in srgb, #8b5cf6 15%, transparent);
  color: #7c3aed;
}

.card-danger {
  border-color: color-mix(in srgb, var(--destructive) 20%, var(--border));
}

.card-title-danger {
  color: var(--destructive);
}

/* ── Badge extras ─────────────────────────────────────────── */
.badge-neutral {
  background-color: var(--muted);
  color: var(--muted-foreground);
  border-color: var(--border);
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

.badge-blue {
  background-color: var(--info-bg);
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 20%, transparent);
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

.badge-purple {
  background-color: color-mix(in srgb, #8b5cf6 12%, transparent);
  color: #7c3aed;
  border-color: color-mix(in srgb, #8b5cf6 25%, transparent);
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

[data-theme="dark"] .badge-purple {
  background-color: color-mix(in srgb, #8b5cf6 20%, transparent);
  color: #c4b5fd;
}

.badge-sm {
  padding: 0.1rem 0.375rem;
  font-size: 0.7rem;
}

.badge-xs {
  padding: 0.05rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
}

/* ── Stat card extras ─────────────────────────────────────── */
.stat-card-icon-blue    { background-color: var(--info-bg); color: var(--info); }
.stat-card-icon-green   { background-color: var(--success-bg); color: var(--success); }
.stat-card-icon-red     { background-color: var(--error-bg); color: var(--destructive); }
.stat-card-icon-purple  {
  background-color: color-mix(in srgb, #8b5cf6 12%, transparent);
  color: #7c3aed;
}

.stat-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.stat-card-meta {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: var(--font-size-sm);
}

.stat-chip-value {
  font-weight: 700;
  font-size: var(--font-size-base);
  color: var(--foreground);
}

.stat-chip-label {
  color: var(--muted-foreground);
  font-size: var(--font-size-xs);
}

.stat-chip-success { border-color: color-mix(in srgb, var(--success) 30%, var(--border)); }
.stat-chip-error   { border-color: color-mix(in srgb, var(--destructive) 30%, var(--border)); }

/* ── Stat card (full card variant with icon on left) ──────── */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.stat-card-label {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  font-weight: 500;
}

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filter-form {
  display: contents;
}

.filter-form-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  width: 100%;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 130px;
}

.filter-group-sm {
  min-width: 130px;
  max-width: 180px;
}

.filter-group-grow {
  flex: 1;
  min-width: 200px;
}

.filter-group-date {
  min-width: 130px;
  max-width: 160px;
}

/* ── Data table aliases ───────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.data-table thead th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  background-color: var(--muted);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-fast);
}

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

.data-table tbody tr:hover {
  background-color: color-mix(in srgb, var(--muted) 60%, transparent);
}

.data-table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.data-table-sm tbody td,
.data-table-sm thead th {
  padding: 0.5rem 0.75rem;
}

.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

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

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

.text-sm {
  font-size: var(--font-size-sm);
}

/* ── Table user cell ─────────────────────────────────────── */
.table-user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.table-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.table-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.table-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-user-name {
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-user-sub {
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  justify-content: flex-end;
}

/* ── Modal (confirm / detail) ────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgb(0 0 0 / 0.5);
  z-index: var(--z-modal-overlay);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: scale-in 0.15s ease;
}

.modal-box-lg {
  max-width: 780px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.modal-subtitle {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.modal-close-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

.modal-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.modal-danger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background-color: var(--error-bg);
  color: var(--destructive);
  margin: 0 auto;
  flex-shrink: 0;
}

.modal-message {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
}

.modal-open {
  overflow: hidden;
}

.log-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .log-detail-grid { grid-template-columns: 1fr; }
}

.code-block {
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  color: var(--foreground);
  margin: 0;
}

/* ── Dashboard layout ─────────────────────────────────────── */
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .dashboard-row { grid-template-columns: 1fr; }
}

.dashboard-card-lg {
  min-width: 0;
}

.dashboard-card-sm {
  min-width: 0;
}

.chart-wrapper {
  position: relative;
  height: 260px;
}

/* ── Activity list ─────────────────────────────────────────── */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.35rem;
}

.activity-dot-success { background-color: var(--success); }
.activity-dot-error   { background-color: var(--destructive); }

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

.activity-title {
  font-size: var(--font-size-sm);
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-service {
  font-weight: 600;
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

/* ── Queue summary ─────────────────────────────────────────── */
.queue-summary {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.queue-stat {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: var(--font-size-sm);
}

.queue-stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.queue-stat-dot-queued   { background-color: var(--info); }
.queue-stat-dot-running  { background-color: var(--warning); }
.queue-stat-dot-error    { background-color: var(--destructive); }
.queue-stat-dot-done     { background-color: var(--success); }

.queue-stat-label {
  flex: 1;
  color: var(--muted-foreground);
}

.queue-stat-value {
  font-weight: 700;
  color: var(--foreground);
}

.queue-cta {
  border-top: 1px solid var(--border);
  padding-top: 0.875rem;
}

/* ── Profile page layout ─────────────────────────────────── */
.profile-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .profile-layout { grid-template-columns: 1fr; }
}

.profile-sidebar-col {
  position: sticky;
  top: calc(var(--topbar-height) + 1.5rem);
}

.profile-main-col {
  min-width: 0;
}

.profile-name-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.profile-display-name {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--foreground);
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  width: 100%;
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
}

.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* ── Avatar upload ─────────────────────────────────────────── */
.avatar-upload-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  overflow: hidden;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initials {
  font-size: 2rem;
  font-weight: 700;
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 26px;
  height: 26px;
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--card);
  transition: opacity var(--transition-fast);
}

.avatar-upload-btn:hover { opacity: 0.85; }

/* Hide the default file input */
input[type="file"]#id_avatar {
  display: none;
}

/* ── Settings page layout ─────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
}

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Quick links ────────────────────────────────────────── */
.quick-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  padding: 0.375rem 0;
  transition: color var(--transition-fast);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.quick-link:last-child { border-bottom: none; }

.quick-link:hover {
  color: var(--foreground);
  opacity: 1;
}

/* ── Danger zone ────────────────────────────────────────── */
.danger-zone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}

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

.danger-zone-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  margin-bottom: 0.125rem;
}

.danger-zone-value {
  font-size: var(--font-size-sm);
  color: var(--foreground);
}

/* ── Form page layout (create/edit forms) ─────────────────── */
.form-page-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .form-page-layout { grid-template-columns: 1fr; }
  .form-page-aside  { order: -1; }
}

.form-page-main  { min-width: 0; }
.form-page-aside { min-width: 0; }

/* ── Hint list (aside card tips) ─────────────────────────── */
.hint-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  line-height: 1.6;
}

.hint-list li strong {
  color: var(--foreground);
}

/* ── Pagination nav ──────────────────────────────────────── */
.pagination-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.pagination-info {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
}

.pagination {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.25rem;
}

.page-item { display: flex; }

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--card);
  color: var(--foreground);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  cursor: pointer;
}

.page-link:hover {
  background-color: var(--accent);
  border-color: var(--border);
  opacity: 1;
}

.page-item.active .page-link {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.page-item.disabled .page-link {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Empty state extras ──────────────────────────────────── */
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background-color: var(--muted);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.empty-state-subtitle {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  max-width: 380px;
  margin: 0 auto 1.5rem;
}

.empty-state-sm {
  padding: 2rem 1.5rem;
}

.empty-state-sm p {
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
  text-align: center;
  margin: 0;
}


/* ============================================================
   Stat card top (icon + value side by side) — ALL screens
   ============================================================ */
.stat-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ============================================================
   MOBILE — Stat cards
   ============================================================ */
@media (max-width: 767px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;
  }

  .stat-card-icon {
    width: 36px;
    height: 36px;
  }

  .stat-card-icon svg {
    width: 16px;
    height: 16px;
  }

  .stat-card-value {
    font-size: var(--font-size-2xl);
  }

  .stat-card-label {
    font-size: var(--font-size-xs);
  }

  .stat-card-meta {
    font-size: 0.65rem;
    color: var(--muted-foreground);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.75rem;
  }

  .stat-card-value {
    font-size: var(--font-size-xl);
  }
}

/* ============================================================
   MOBILE — Tabela ultimas publicacoes cards
   ============================================================ */
@media (max-width: 767px) {
  .data-table-mobile-cards thead {
    display: none;
  }

  .data-table-mobile-cards tbody tr {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
  }

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

  .data-table-mobile-cards tbody td {
    display: flex;
    align-items: center;
    padding: 0;
    border: none;
    font-size: var(--font-size-sm);
  }

  .data-table-mobile-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: var(--font-size-xs);
    color: var(--muted-foreground);
    min-width: 70px;
    flex-shrink: 0;
  }

  .dashboard-row {
    gap: 0.75rem;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .page-header-actions {
    flex-wrap: wrap;
  }
}

