/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* =============================================================================
   Brags Design System - CSS Custom Properties
   ============================================================================= */

:root {
  /* Primary Brand Colors */
  --primary-50: rgb(239 246 255);   /* blue-50 */
  --primary-100: rgb(219 234 254);  /* blue-100 */
  --primary-500: rgb(59 130 246);   /* blue-500 */
  --primary-600: rgb(37 99 235);    /* blue-600 - Primary brand color */
  --primary-700: rgb(29 78 216);    /* blue-700 */
  --primary-800: rgb(30 64 175);    /* blue-800 */

  /* Semantic Colors */
  --success-50: rgb(240 253 244);   /* green-50 */
  --success-200: rgb(187 247 208);  /* green-200 */
  --success-400: rgb(74 222 128);   /* green-400 */
  --success-600: rgb(22 163 74);    /* green-600 */
  --success-800: rgb(22 101 52);    /* green-800 */

  --warning-50: rgb(254 252 232);   /* yellow-50 */
  --warning-200: rgb(254 240 138);  /* yellow-200 */
  --warning-400: rgb(250 204 21);   /* yellow-400 */
  --warning-600: rgb(202 138 4);    /* yellow-600 */
  --warning-800: rgb(133 77 14);    /* yellow-800 */

  --error-50: rgb(254 242 242);     /* red-50 */
  --error-200: rgb(254 202 202);    /* red-200 */
  --error-400: rgb(248 113 113);    /* red-400 */
  --error-600: rgb(220 38 38);      /* red-600 */
  --error-800: rgb(153 27 27);      /* red-800 */

  /* Neutral Colors */
  --gray-50: rgb(249 250 251);      /* gray-50 */
  --gray-100: rgb(243 244 246);     /* gray-100 */
  --gray-200: rgb(229 231 235);     /* gray-200 */
  --gray-300: rgb(209 213 219);     /* gray-300 */
  --gray-400: rgb(156 163 175);     /* gray-400 */
  --gray-500: rgb(107 114 128);     /* gray-500 */
  --gray-600: rgb(75 85 99);        /* gray-600 */
  --gray-700: rgb(55 65 81);        /* gray-700 */
  --gray-800: rgb(31 41 55);        /* gray-800 */
  --gray-900: rgb(17 24 39);        /* gray-900 */

  /* Shared UI Foundation Tokens */
  --ui-surface-canvas: var(--gray-50);
  --ui-surface-card: rgb(255 255 255);
  --ui-surface-card-muted: var(--gray-50);
  --ui-surface-strong: var(--gray-100);
  --ui-border-subtle: var(--gray-200);
  --ui-border-strong: var(--gray-300);
  --ui-text-heading: var(--gray-900);
  --ui-text-body: var(--gray-700);
  --ui-text-muted: var(--gray-500);
  --ui-radius-card: 0.875rem;
  --ui-radius-control: 0.625rem;
  --ui-shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 20px rgba(16, 24, 40, 0.06);
  --ui-shadow-soft-hover: 0 2px 6px rgba(16, 24, 40, 0.08), 0 14px 28px rgba(16, 24, 40, 0.08);
  --ui-focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.2);
  --ui-title-size-lg: 1.5rem;
  --ui-title-size-md: 1.125rem;
  --ui-title-size-sm: 1rem;
  --ui-body-size: 0.95rem;
  --ui-body-line-height: 1.55;
  --ui-meta-size: 0.8125rem;
  --ui-meta-line-height: 1.4;
  --ui-transition-fast: 140ms ease;
  --ui-transition-standard: 220ms ease;

  /* Workflow Accent Tokens */
  --brand-50: var(--primary-50);
  --brand-100: var(--primary-100);
  --brand-600: var(--primary-600);
  --brand-700: var(--primary-700);

  /* Pro Feature Tokens (subtle premium signature) */
  --pro-50: rgb(254 242 236);       /* copper-50 */
  --pro-100: rgb(251 228 214);      /* copper-100 */
  --pro-200: rgb(237 192 163);      /* copper-200 */
  --pro-600: rgb(155 74 42);        /* copper-700 */
  --pro-700: rgb(123 58 33);        /* copper-800 */

  /* Workflow Surface Tokens */
  --surface-1: var(--ui-surface-card);
  --surface-2: var(--ui-surface-card-muted);
  --surface-3: var(--ui-surface-strong);

  /* Workflow Modal Shell Tokens */
  --modal-max-width-sm: 28rem;
  --modal-max-width-md: 34rem;
  --modal-max-width-lg: 42rem;
  --modal-max-width-xl: 56rem;
  --radius-card: var(--ui-radius-card);
  --radius-action: var(--ui-radius-control);
  --shadow-card: 0 18px 40px rgba(17, 24, 39, 0.12), 0 2px 8px rgba(17, 24, 39, 0.05);
  --shadow-focus: var(--ui-focus-ring);

  /* Workflow Typography Tokens */
  --text-display-size: 1.5rem;
  --text-display-line-height: 1.3;
  --text-display-weight: 700;
  --text-title-size: var(--ui-title-size-md);
  --text-title-line-height: 1.4;
  --text-title-weight: 600;
  --text-body-size: var(--ui-body-size);
  --text-body-line-height: var(--ui-body-line-height);
  --text-body-weight: 400;
  --text-meta-size: var(--ui-meta-size);
  --text-meta-line-height: var(--ui-meta-line-height);
  --text-meta-weight: 500;
  --tracking-display: -0.01em;
  --wf-marker-size: 0.45rem;

  /* App/UI compatibility aliases */
  --app-surface-canvas: var(--ui-surface-canvas);
  --app-surface-card: var(--ui-surface-card);
  --app-surface-card-muted: var(--ui-surface-card-muted);
  --app-border-subtle: var(--ui-border-subtle);
  --app-border-strong: var(--ui-border-strong);
  --app-text-heading: var(--ui-text-heading);
  --app-text-body: var(--ui-text-body);
  --app-text-muted: var(--ui-text-muted);
  --app-radius-card: var(--ui-radius-card);
  --app-radius-control: var(--ui-radius-control);
  --app-shadow-soft: var(--ui-shadow-soft);
  --app-shadow-soft-hover: var(--ui-shadow-soft-hover);
  --app-focus-ring: var(--ui-focus-ring);
  --app-title-size-lg: var(--ui-title-size-lg);
  --app-title-size-md: var(--ui-title-size-md);
  --app-title-size-sm: var(--ui-title-size-sm);
  --app-body-size: var(--ui-body-size);
  --app-body-line-height: var(--ui-body-line-height);
  --app-meta-size: var(--ui-meta-size);
  --app-meta-line-height: var(--ui-meta-line-height);
  --app-transition-fast: var(--ui-transition-fast);
  --app-transition-standard: var(--ui-transition-standard);
}

/* =============================================================================
   Workflow Modal Primitives
   ============================================================================= */

.wf-shell {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: var(--surface-1);
  color: var(--gray-900);
  position: relative;
  overflow: hidden;
  background-clip: padding-box;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  box-sizing: border-box;
}

.wf-size-sm {
  --wf-shell-max-width: var(--modal-max-width-sm);
}

.wf-size-md {
  --wf-shell-max-width: var(--modal-max-width-md);
}

.wf-size-lg {
  --wf-shell-max-width: var(--modal-max-width-lg);
}

.wf-size-xl {
  --wf-shell-max-width: var(--modal-max-width-xl);
}

.wf-shell-inline {
  width: min(100%, var(--wf-shell-max-width, var(--modal-max-width-md)));
  max-width: var(--wf-shell-max-width, var(--modal-max-width-md));
}

.wf-shell-modal {
  width: var(--wf-shell-max-width, var(--modal-max-width-md));
  max-width: min(calc(100vw - 2rem), var(--wf-shell-max-width, var(--modal-max-width-md)));
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
}

.wf-shell-modal .wf-shell-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.wf-shell-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--surface-1);
}

.wf-shell-title {
  margin: 0;
  font-size: var(--text-title-size);
  line-height: var(--text-title-line-height);
  font-weight: var(--text-title-weight);
  color: var(--gray-900);
  letter-spacing: -0.005em;
}

.wf-shell-subtitle {
  margin: 0.25rem 0 0;
  font-size: var(--text-meta-size);
  line-height: var(--text-meta-line-height);
  font-weight: var(--text-body-weight);
  color: var(--gray-500);
}

.wf-shell-body {
  padding: 1.25rem;
}

.wf-close-button {
  border: 0;
  border-radius: var(--radius-action);
  background: transparent;
  color: var(--gray-400);
  padding: 0.375rem;
  line-height: 1;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}

.wf-close-button:hover {
  color: var(--gray-600);
  background-color: var(--surface-2);
}

.wf-close-button:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.wf-status-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.wf-status-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.wf-status-icon-svg {
  width: 1rem;
  height: 1rem;
}

.wf-state-info {
  background: var(--brand-50);
  color: var(--brand-700);
  border-color: var(--brand-100);
}

.wf-state-pro {
  background: var(--pro-50);
  color: var(--pro-700);
  border-color: var(--pro-200);
}

.wf-state-success {
  background: var(--success-50);
  color: var(--success-800);
  border-color: var(--success-200);
}

.wf-state-warning {
  background: var(--warning-50);
  color: var(--warning-800);
  border-color: var(--warning-200);
}

.wf-state-error {
  background: var(--error-50);
  color: var(--error-800);
  border-color: var(--error-200);
}

.wf-status-title {
  margin: 0;
  color: var(--gray-900);
  font-size: var(--text-title-size);
  line-height: var(--text-title-line-height);
  font-weight: var(--text-title-weight);
  letter-spacing: var(--tracking-display);
}

.wf-status-subtitle {
  margin: 0.25rem 0 0;
  color: var(--gray-600);
  font-size: var(--text-body-size);
  line-height: var(--text-body-line-height);
}

.wf-section-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-action);
  background: var(--surface-2);
  padding: 0.875rem;
  margin-bottom: 1rem;
}

.wf-section-neutral {
  background: var(--surface-2);
  border-color: var(--gray-200);
}

.wf-section-brand {
  background: var(--brand-50);
  border-color: var(--brand-100);
}

.wf-section-success {
  background: var(--success-50);
  border-color: var(--success-200);
}

.wf-section-warning {
  background: var(--warning-50);
  border-color: var(--warning-200);
}

.wf-section-error {
  background: var(--error-50);
  border-color: var(--error-200);
}

.wf-section-pro {
  background: var(--pro-50);
  border-color: var(--pro-200);
}

.wf-list,
.wf-pro-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.95rem;
  color: var(--gray-700);
}

.wf-list li,
.wf-pro-list li {
  position: relative;
  padding-left: 1rem;
}

.wf-list li::before,
.wf-pro-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  transform: translateY(-50%);
  width: var(--wf-marker-size);
  height: var(--wf-marker-size);
  border-radius: 999px;
  background: var(--wf-list-marker-color, var(--gray-500));
}

.wf-section-neutral .wf-list,
.wf-section-neutral .wf-pro-list {
  --wf-list-marker-color: var(--gray-500);
}

.wf-section-brand .wf-list,
.wf-section-brand .wf-pro-list {
  --wf-list-marker-color: var(--brand-600);
}

.wf-section-success .wf-list,
.wf-section-success .wf-pro-list {
  --wf-list-marker-color: var(--success-600);
}

.wf-section-warning .wf-list,
.wf-section-warning .wf-pro-list {
  --wf-list-marker-color: var(--warning-600);
}

.wf-section-error .wf-list,
.wf-section-error .wf-pro-list {
  --wf-list-marker-color: var(--error-600);
}

.wf-section-pro .wf-list,
.wf-section-pro .wf-pro-list {
  --wf-list-marker-color: var(--pro-600);
}

.wf-section-title {
  margin: 0;
  color: var(--gray-900);
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 600;
}

.wf-section-body {
  margin: 0.35rem 0 0;
  color: var(--gray-600);
  font-size: var(--text-body-size);
  line-height: var(--text-body-line-height);
}

.wf-action-row {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

.wf-inline-guidance {
  margin: 0;
  color: var(--gray-600);
  font-size: var(--text-meta-size);
  line-height: var(--text-meta-line-height);
}

.wf-type-toggle {
  position: relative;
  isolation: isolate;
}

.wf-type-toggle-indicator {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  bottom: 0.25rem;
  width: calc(50% - 0.25rem);
  border-radius: calc(var(--radius-action) - 0.125rem);
  background: var(--success-600);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
  transition:
    transform 500ms cubic-bezier(0.16, 1, 0.3, 1),
    background 320ms ease,
    box-shadow 320ms ease;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.wf-type-toggle[data-entry-type="blocker"] .wf-type-toggle-indicator {
  transform: translateX(100%);
  background: var(--error-600);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}

.wf-type-toggle button[data-entry-type] {
  position: relative;
  z-index: 1;
  transition: color 260ms ease;
}

.wf-type-toggle[data-entry-type="achievement"] button[data-entry-type="achievement"],
.wf-type-toggle[data-entry-type="blocker"] button[data-entry-type="blocker"] {
  color: white;
}

.wf-advanced-fields {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-0.25rem);
  transition: max-height 760ms cubic-bezier(0.2, 0.95, 0.2, 1), opacity 580ms ease, transform 580ms ease;
  will-change: max-height, opacity, transform;
}

.wf-advanced-fields.is-open {
  max-height: 120rem;
  opacity: 1;
  transform: translateY(0);
}

.wf-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.625rem;
  border-radius: var(--radius-action);
  border: 1px solid transparent;
  padding: 0.625rem 1rem;
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.wf-button:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.wf-button-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: white;
}

.wf-button-primary:hover {
  background: var(--brand-700);
  border-color: var(--brand-700);
}

.wf-button-pro {
  background: var(--pro-700);
  border-color: var(--pro-700);
  color: white;
}

.wf-button-pro:hover {
  background: var(--pro-600);
  border-color: var(--pro-600);
}

.wf-button-secondary {
  background: white;
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.wf-button-secondary:hover {
  background: var(--surface-2);
}

.wf-button-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--gray-600);
}

.wf-button-ghost:hover {
  background: var(--surface-2);
  color: var(--gray-700);
}

.wf-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.875rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  border: 1px solid var(--pro-200);
  background: var(--pro-50);
  color: var(--pro-700);
  font-size: var(--text-meta-size);
  line-height: var(--text-meta-line-height);
  font-weight: 600;
}

.wf-pro-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: var(--pro-600);
}

.wf-pro-theme {
  --pro-50: rgb(254 242 236);
  --pro-100: rgb(251 228 214);
  --pro-200: rgb(237 192 163);
  --pro-600: rgb(155 74 42);
  --pro-700: rgb(123 58 33);
}

/* Amber with warning separated toward orange to reduce collision */
.wf-pro-theme-amber {
  --pro-50: rgb(255 251 235);
  --pro-100: rgb(254 243 199);
  --pro-200: rgb(253 230 138);
  --pro-600: rgb(180 83 9);
  --pro-700: rgb(146 64 14);
  --warning-50: rgb(255 247 237);
  --warning-400: rgb(251 146 60);
  --warning-600: rgb(234 88 12);
  --warning-800: rgb(154 52 18);
}

.wf-pro-theme-copper {
  --pro-50: rgb(254 242 236);
  --pro-100: rgb(251 228 214);
  --pro-200: rgb(237 192 163);
  --pro-600: rgb(155 74 42);
  --pro-700: rgb(123 58 33);
}

.wf-pro-theme-indigo {
  --pro-50: rgb(238 242 255);
  --pro-100: rgb(224 231 255);
  --pro-200: rgb(199 210 254);
  --pro-600: rgb(67 56 202);
  --pro-700: rgb(55 48 163);
}

.wf-pro-theme-teal {
  --pro-50: rgb(240 253 250);
  --pro-100: rgb(204 251 241);
  --pro-200: rgb(153 246 228);
  --pro-600: rgb(13 148 136);
  --pro-700: rgb(15 118 110);
}

.wf-pro-theme-teal .wf-pro-badge {
  background: linear-gradient(90deg, rgb(240 253 250), rgb(255 251 235));
  border-color: rgb(167 243 208);
}

.wf-autoclose-indicator {
  margin-top: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray-500);
  font-size: var(--text-meta-size);
  line-height: var(--text-meta-line-height);
}

.wf-autoclose-ring {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
}

.wf-autoclose-ring-bg {
  stroke: var(--gray-200);
}

.wf-autoclose-ring-progress {
  stroke: var(--brand-600);
  stroke-dasharray: 31.4;
  stroke-dashoffset: 0;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
  animation: wf-autoclose-countdown var(--wf-autoclose-ms, 4000ms) linear forwards;
}

@keyframes wf-autoclose-countdown {
  to {
    stroke-dashoffset: 31.4;
  }
}

.wf-loading-progress {
  position: relative;
  overflow: hidden;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--gray-200);
}

.wf-loading-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 48%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-700));
  animation: wf-loading-sweep 2200ms ease-in-out infinite;
}

.wf-loading-progress-pro::after {
  background: linear-gradient(90deg, var(--pro-600), var(--pro-700));
}

@keyframes wf-loading-sweep {
  0% {
    transform: translateX(-95%);
  }
  50% {
    transform: translateX(55%);
  }
  100% {
    transform: translateX(190%);
  }
}

.wf-loading-step-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.wf-loading-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-body-size);
  color: var(--gray-700);
}

.wf-loading-step-dot {
  width: var(--wf-marker-size);
  height: var(--wf-marker-size);
  border-radius: 999px;
  background: var(--brand-600);
  opacity: 0.75;
}

.wf-section-pro .wf-loading-step-dot {
  background: var(--pro-600);
  opacity: 0.85;
}

.wf-description-input {
  min-height: 7rem;
}

.wf-comparison-grid {
  display: grid;
  gap: 0.875rem;
  margin-bottom: 1rem;
}

.wf-comparison-panel {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-action);
  background: white;
  padding: 0.75rem;
}

.wf-comparison-meta {
  margin: 0 0 0.5rem;
  color: var(--gray-500);
  font-size: var(--text-meta-size);
  line-height: var(--text-meta-line-height);
}

.wf-comparison-text {
  margin: 0;
  color: var(--gray-700);
  font-size: var(--text-body-size);
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (prefers-reduced-motion: reduce) {
  .wf-advanced-fields {
    transition: none;
  }

  .wf-loading-progress::after,
  .wf-autoclose-ring-progress {
    animation: none;
  }

  .wf-type-toggle-indicator {
    transition: none;
  }
}

@media (max-width: 639px) {
  .wf-description-input {
    min-height: 5.75rem;
  }
}

@media (min-width: 640px) {
  .wf-shell-header {
    padding: 1.125rem 1.5rem;
  }

  .wf-shell-body {
    padding: 1.5rem;
  }

  .wf-action-row {
    flex-direction: row;
    justify-content: flex-end;
  }

  .wf-comparison-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =============================================================================
   App UI Foundation Utilities (Phase 1)
   ============================================================================= */

.app-ui-surface-canvas {
  background: var(--app-surface-canvas);
}

.app-ui-surface-card {
  background: var(--app-surface-card);
  border: 1px solid var(--app-border-subtle);
  border-radius: var(--app-radius-card);
}

.app-ui-surface-card-muted {
  background: var(--app-surface-card-muted);
  border: 1px solid var(--app-border-subtle);
  border-radius: var(--app-radius-card);
}

.app-ui-surface-muted {
  background: var(--app-surface-card-muted);
}

.app-ui-surface-success {
  background: var(--success-50);
  border: 1px solid var(--success-200);
  border-radius: var(--app-radius-card);
}

.app-ui-surface-warning {
  background: var(--warning-50);
  border: 1px solid var(--warning-200);
  border-radius: var(--app-radius-card);
}

.app-ui-surface-error {
  background: var(--error-50);
  border: 1px solid var(--error-200);
  border-radius: var(--app-radius-card);
}

.app-ui-divide-subtle > :not([hidden]) ~ :not([hidden]) {
  border-top: 1px solid var(--app-border-subtle);
}

.app-ui-hover-border-brand:hover {
  border-color: var(--brand-100);
}

.app-ui-hover-border-brand {
  transition: border-color var(--app-transition-fast);
}

.app-ui-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-control);
  background: var(--app-surface-card);
  color: var(--app-text-body);
  transition:
    background-color var(--app-transition-fast),
    border-color var(--app-transition-fast),
    color var(--app-transition-fast),
    box-shadow var(--app-transition-fast);
}

.app-ui-icon-btn:hover {
  background: var(--app-surface-card-muted);
}

.app-ui-icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--app-focus-ring);
}

.app-ui-icon-btn-brand {
  border-color: var(--brand-100);
  background: var(--brand-50);
  color: var(--brand-700);
}

.app-ui-icon-btn-brand:hover {
  background: var(--primary-100);
  border-color: var(--brand-100);
}

.app-ui-icon-btn-danger {
  border-color: var(--error-200);
  background: var(--error-50);
  color: var(--error-800);
}

.app-ui-icon-btn-danger:hover {
  background: var(--error-200);
  border-color: var(--error-200);
}

.app-ui-pagination-link {
  background: var(--app-surface-card);
  border: 1px solid var(--app-border-strong);
  color: var(--app-text-muted);
  transition: background-color var(--app-transition-fast), color var(--app-transition-fast), border-color var(--app-transition-fast);
}

.app-ui-pagination-link:hover {
  background: var(--app-surface-card-muted);
  color: var(--app-text-body);
}

.app-ui-pagination-link-active {
  background: var(--brand-50);
  border-color: var(--brand-600);
  color: var(--brand-700);
}

.app-ui-card-elevated {
  box-shadow: var(--app-shadow-soft);
  transition: box-shadow var(--app-transition-standard), border-color var(--app-transition-standard);
}

.app-ui-card-elevated:hover {
  box-shadow: var(--app-shadow-soft-hover);
  border-color: var(--app-border-strong);
}

.app-ui-card-static {
  box-shadow: var(--app-shadow-soft);
}

:where(.app-ui-title-lg) {
  color: var(--app-text-heading);
  font-size: var(--app-title-size-lg);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: var(--tracking-display);
}

:where(.app-ui-title-md) {
  color: var(--app-text-heading);
  font-size: var(--app-title-size-md);
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.005em;
}

:where(.app-ui-title-sm) {
  color: var(--app-text-heading);
  font-size: var(--app-title-size-sm);
  line-height: 1.4;
  font-weight: 600;
}

:where(.app-ui-text-body) {
  color: var(--app-text-body);
  font-size: var(--app-body-size);
  line-height: var(--app-body-line-height);
}

:where(.app-ui-text-muted) {
  color: var(--app-text-muted);
  font-size: var(--app-meta-size);
  line-height: var(--app-meta-line-height);
}

.app-ui-text-heading {
  color: var(--app-text-heading);
}

.app-ui-no-transition {
  transition: none !important;
}

.app-ui-focus-ring:focus-visible {
  outline: none;
  box-shadow: var(--app-focus-ring);
}

.app-ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  gap: 0.5rem;
  border-width: 1px;
  border-style: solid;
  border-radius: var(--app-radius-control);
  padding: 0.625rem 1rem;
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color var(--app-transition-fast),
    border-color var(--app-transition-fast),
    color var(--app-transition-fast),
    box-shadow var(--app-transition-fast);
}

.app-ui-btn-sm {
  min-height: 2.25rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
}

.app-ui-btn-lg {
  min-height: 2.75rem;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
}

.app-ui-btn:focus-visible {
  outline: none;
  box-shadow: var(--app-focus-ring);
}

.app-ui-btn:disabled,
.app-ui-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.app-ui-btn-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: white;
}

.app-ui-btn-primary:hover {
  background: var(--brand-700);
  border-color: var(--brand-700);
}

.app-ui-btn-secondary {
  background: var(--app-surface-card);
  border-color: var(--app-border-strong);
  color: var(--gray-700);
}

.app-ui-btn-secondary:hover {
  background: var(--app-surface-card-muted);
}

.app-ui-btn-pro {
  background: var(--pro-700);
  border-color: var(--pro-700);
  color: white;
}

.app-ui-btn-pro:hover {
  background: var(--pro-600);
  border-color: var(--pro-600);
}

.app-ui-btn-pro-subtle {
  background: var(--pro-50);
  border-color: var(--pro-200);
  color: var(--pro-700);
}

.app-ui-btn-pro-subtle:hover {
  background: var(--pro-100);
  border-color: var(--pro-200);
}

.app-ui-btn-danger {
  background: var(--error-600);
  border-color: var(--error-600);
  color: white;
}

.app-ui-btn-danger:hover {
  background: var(--error-800);
  border-color: var(--error-800);
}

.app-ui-btn-danger-subtle {
  background: var(--error-50);
  border-color: var(--error-200);
  color: var(--error-800);
}

.app-ui-btn-danger-subtle:hover {
  background: var(--error-200);
  border-color: var(--error-200);
}

.app-ui-btn-success {
  background: var(--success-600);
  border-color: var(--success-600);
  color: white;
}

.app-ui-btn-success:hover {
  background: var(--success-800);
  border-color: var(--success-800);
}

.app-ui-btn-success-subtle {
  background: var(--success-50);
  border-color: var(--success-200);
  color: var(--success-800);
}

.app-ui-btn-success-subtle:hover {
  background: var(--success-200);
  border-color: var(--success-200);
}

.app-ui-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--gray-600);
}

.app-ui-btn-ghost:hover {
  background: var(--app-surface-card-muted);
  color: var(--gray-700);
}

.app-ui-link-muted {
  color: var(--app-text-body);
  transition: color var(--app-transition-fast);
}

.app-ui-link-muted:hover {
  color: var(--app-text-heading);
}

.app-ui-link-brand {
  color: var(--brand-600);
  transition: color var(--app-transition-fast);
}

.app-ui-link-brand:hover {
  color: var(--brand-700);
}

.app-ui-link-pro {
  color: var(--pro-700);
  transition: color var(--app-transition-fast);
}

.app-ui-link-pro:hover {
  color: var(--pro-600);
}

.app-ui-text-brand {
  color: var(--brand-600);
}

.app-ui-text-success {
  color: var(--success-600);
}

.app-ui-text-warning {
  color: var(--warning-600);
}

.app-ui-text-error {
  color: var(--error-600);
}

.app-ui-text-xs {
  font-size: 0.75rem;
  line-height: 1.25;
}

.app-ui-text-sm {
  font-size: 0.875rem;
  line-height: 1.5;
}

.app-ui-label {
  color: var(--app-text-muted);
  font-size: var(--app-meta-size);
  line-height: var(--app-meta-line-height);
  font-weight: 600;
}

.app-ui-link-action {
  font-size: var(--app-meta-size);
  line-height: var(--app-meta-line-height);
  font-weight: 600;
}

.app-ui-eyebrow {
  font-size: 0.75rem;
  line-height: 1.25;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.app-ui-font-normal {
  font-weight: 400;
}

.app-ui-font-semibold {
  font-weight: 600;
}

.app-ui-font-bold {
  font-weight: 700;
}

.app-ui-no-resize {
  resize: none;
}

.app-ui-radius-xs {
  border-radius: 0.25rem;
}

.app-ui-radius-lg {
  border-radius: 0.5rem;
}

.app-ui-radius-xl {
  border-radius: 0.75rem;
}

.app-ui-radius-l {
  border-top-left-radius: var(--app-radius-control);
  border-bottom-left-radius: var(--app-radius-control);
}

.app-ui-radius-r {
  border-top-right-radius: var(--app-radius-control);
  border-bottom-right-radius: var(--app-radius-control);
}

.app-ui-pro-panel {
  background: var(--pro-50);
  border: 1px solid var(--pro-200);
  border-radius: var(--app-radius-card);
  padding: 1rem;
}

.app-ui-ring-brand {
  border-color: var(--brand-100);
  box-shadow: 0 0 0 2px var(--brand-600), 0 0 0 5px rgb(37 99 235 / 0.12);
}

.app-ui-ring-success {
  border-color: var(--success-200);
  box-shadow: 0 0 0 2px var(--success-600), 0 0 0 5px rgb(22 163 74 / 0.12);
}

.app-ui-ring-muted {
  border-color: var(--app-border-strong);
  box-shadow: 0 0 0 2px var(--gray-500), 0 0 0 5px rgb(107 114 128 / 0.12);
}

.app-ui-ring-pro {
  border-color: var(--pro-200);
  box-shadow: 0 0 0 2px var(--pro-600), 0 0 0 5px rgb(155 74 42 / 0.12);
}

.app-ui-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.75rem;
  line-height: 1.25;
  font-weight: 600;
}

.app-ui-badge-muted {
  background: var(--app-surface-card-muted);
  border-color: var(--app-border-subtle);
  color: var(--gray-700);
}

.app-ui-badge-brand {
  background: var(--brand-50);
  border-color: var(--brand-100);
  color: var(--brand-700);
}

.app-ui-badge-pro {
  background: var(--pro-50);
  border-color: var(--pro-200);
  color: var(--pro-700);
}

.app-ui-badge-success {
  background: var(--success-50);
  border-color: var(--success-200);
  color: var(--success-800);
}

.app-ui-badge-warning {
  background: var(--warning-50);
  border-color: var(--warning-200);
  color: var(--warning-800);
}

.app-ui-badge-error {
  background: var(--error-50);
  border-color: var(--error-200);
  color: var(--error-800);
}

.app-ui-alert {
  border: 1px solid transparent;
  border-radius: var(--app-radius-control);
  padding: 0.875rem 1rem;
}

.app-ui-alert-brand {
  background: var(--brand-50);
  border-color: var(--brand-100);
  color: var(--brand-700);
}

.app-ui-alert-success {
  background: var(--success-50);
  border-color: var(--success-200);
  color: var(--success-800);
}

.app-ui-alert-warning {
  background: var(--warning-50);
  border-color: var(--warning-200);
  color: var(--warning-800);
}

.app-ui-alert-error {
  background: var(--error-50);
  border-color: var(--error-200);
  color: var(--error-800);
}

.app-ui-icon-surface {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
}

.app-ui-icon-surface-muted {
  background: var(--app-surface-card-muted);
  color: var(--gray-600);
}

.app-ui-icon-surface-brand {
  background: var(--brand-50);
  color: var(--brand-600);
}

.app-ui-icon-surface-pro {
  background: var(--pro-50);
  color: var(--pro-600);
}

.app-ui-pro-surface {
  background: var(--pro-50);
  border-color: var(--pro-200);
}

.app-ui-pro-heading {
  color: var(--pro-700);
}

.app-ui-pro-text {
  color: var(--pro-600);
}

.app-ui-icon-surface-success {
  background: var(--success-50);
  color: var(--success-600);
}

.app-ui-icon-surface-warning {
  background: var(--warning-50);
  color: var(--warning-600);
}

.app-ui-icon-surface-error {
  background: var(--error-50);
  color: var(--error-600);
}

.app-ui-input,
.app-ui-select,
.app-ui-textarea {
  width: 100%;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--app-radius-control);
  background: var(--app-surface-card);
  color: var(--app-text-heading);
  font-size: 0.95rem;
  line-height: 1.4;
  padding: 0.625rem 0.75rem;
  transition:
    border-color var(--app-transition-fast),
    box-shadow var(--app-transition-fast);
}

.app-ui-textarea {
  resize: vertical;
}

.app-ui-input::placeholder,
.app-ui-textarea::placeholder {
  color: var(--app-text-muted);
}

.app-ui-input:focus-visible,
.app-ui-select:focus-visible,
.app-ui-textarea:focus-visible {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: var(--app-focus-ring);
}

.app-ui-field-label {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--app-text-body);
  font-size: 0.8125rem;
  line-height: 1.4;
  font-weight: 600;
}

.app-ui-field-help {
  margin-top: 0.25rem;
  color: var(--app-text-muted);
  font-size: var(--app-meta-size);
  line-height: var(--app-meta-line-height);
}

.app-ui-divider {
  border-top: 1px solid var(--app-border-subtle);
}

.app-ui-border-subtle {
  border-color: var(--app-border-subtle);
}

.app-ui-border-strong {
  border-color: var(--app-border-strong);
}

.app-ui-dashboard-shell {
  min-height: calc(100vh - 7rem);
}

.app-ui-empty-state-layout {
  min-height: calc(100vh - 7rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

.app-ui-empty-state-card {
  width: min(100%, 42rem);
  padding: 2rem 1.5rem;
  text-align: center;
}

/* =============================================================================
   Onboarding Progress
   ============================================================================= */

.onb-progress {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
  pointer-events: none;
}

.onb-donut {
  width: 2rem;
  height: 2rem;
  display: block;
  transform: rotate(-90deg);
}

.onb-donut-track,
.onb-donut-fill {
  fill: none;
  stroke-width: 4;
}

.onb-donut-track {
  stroke: var(--gray-300);
}

.onb-donut-fill {
  stroke: var(--primary-600);
  stroke-linecap: round;
  stroke-dashoffset: 81.68;
  transition: stroke-dashoffset 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 640px) {
  .app-ui-empty-state-card {
    padding: 2.5rem 2rem;
  }
}

@media (max-width: 639px) {
  .app-ui-title-lg {
    font-size: 1.375rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .onb-donut-fill {
    transition: none;
  }
}

/* =============================================================================
   App Grid Background (signed-in UI)
   ============================================================================= */

.app-grid-bg {
  background-color: var(--gray-50);
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.07) 1px, transparent 1px);
  background-size: 60px 60px;
  background-position: center;
  position: relative;
}

.app-grid-bg::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(249, 250, 251, 1) 0%,
    rgba(249, 250, 251, 0) 12%,
    rgba(249, 250, 251, 0) 88%,
    rgba(249, 250, 251, 1) 100%
  );
  pointer-events: none;
  z-index: -1;
}

/* =============================================================================
   Onboarding Background Layer
   ============================================================================= */

.onb-bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, #f8fafc 0%, #f9fafb 55%, #fcfcfd 100%);
}

.onb-bg-layer::before,
.onb-bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.onb-bg-layer::before {
  background-image:
    linear-gradient(rgba(156, 163, 175, 0.17) 1px, transparent 1px),
    linear-gradient(90deg, rgba(156, 163, 175, 0.17) 1px, transparent 1px);
  background-size: 60px 60px;
}

.onb-bg-layer::after {
  background:
    linear-gradient(
      135deg,
      rgba(248, 250, 252, 0.9) 0%,
      rgba(248, 250, 252, 0.35) 16%,
      transparent 28%,
      transparent 74%,
      rgba(248, 250, 252, 0.25) 86%,
      rgba(248, 250, 252, 0.75) 100%
    ),
    linear-gradient(
      to bottom,
      transparent 0%,
      transparent 52%,
      rgba(248, 250, 252, 0.14) 66%,
      rgba(248, 250, 252, 0.42) 80%,
      rgba(248, 250, 252, 0.78) 90%,
      rgba(248, 250, 252, 1) 100%
    ),
    linear-gradient(
      to right,
      rgba(248, 250, 252, 0.84) 0%,
      rgba(248, 250, 252, 0.45) 9%,
      transparent 22%,
      transparent 78%,
      rgba(248, 250, 252, 0.2) 92%,
      rgba(248, 250, 252, 0.35) 100%
    );
}

.onb-floating-shapes {
  position: absolute;
  inset: -6% -4%;
}

.onb-shape {
  position: absolute;
  border-radius: 999px;
  opacity: 0.34;
  filter: blur(0.7px);
}

.onb-shape-1 {
  width: 140px;
  height: 140px;
  top: 10%;
  left: 22%;
  background: linear-gradient(45deg, rgba(59, 130, 246, 0.26), rgba(16, 185, 129, 0.18));
  animation: onb-float-a 32s ease-in-out infinite;
}

.onb-shape-2 {
  width: 96px;
  height: 96px;
  top: 8%;
  right: 24%;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(59, 130, 246, 0.16));
  animation: onb-float-b 28s ease-in-out infinite;
}

.onb-shape-3 {
  width: 70px;
  height: 70px;
  top: 26%;
  left: 18%;
  border-radius: 32%;
  background: rgba(59, 130, 246, 0.22);
  animation: onb-float-c 24s ease-in-out infinite;
}

.onb-shape-4 {
  width: 132px;
  height: 132px;
  top: 30%;
  right: 15%;
  border-radius: 38%;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.18), rgba(59, 130, 246, 0.12));
  animation: onb-float-d 34s ease-in-out infinite;
}

.onb-shape-5 {
  width: 56px;
  height: 56px;
  bottom: 24%;
  left: 26%;
  background: rgba(16, 185, 129, 0.25);
  animation: onb-float-e 22s ease-in-out infinite;
}

.onb-shape-6 {
  width: 104px;
  height: 104px;
  bottom: 20%;
  right: 24%;
  border-radius: 28%;
  background: linear-gradient(225deg, rgba(59, 130, 246, 0.2), rgba(16, 185, 129, 0.12));
  animation: onb-float-f 30s ease-in-out infinite;
}

.onb-shape-7 {
  width: 78px;
  height: 78px;
  top: 18%;
  left: 56%;
  background: rgba(59, 130, 246, 0.18);
  animation: onb-float-b 26s ease-in-out infinite;
}

.onb-shape-8 {
  width: 88px;
  height: 88px;
  bottom: 28%;
  right: 44%;
  border-radius: 30%;
  background: rgba(16, 185, 129, 0.2);
  animation: onb-float-c 36s ease-in-out infinite;
}

@keyframes onb-float-a {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  35% { transform: translate(24px, -18px) rotate(38deg); }
  70% { transform: translate(-20px, 14px) rotate(76deg); }
}

@keyframes onb-float-b {
  0%, 100% { transform: translate(0, 0) rotate(8deg); }
  50% { transform: translate(-30px, -22px) rotate(60deg); }
}

@keyframes onb-float-c {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  30% { transform: translate(18px, 12px) scale(1.07) rotate(120deg); }
  75% { transform: translate(-14px, -10px) scale(0.94) rotate(240deg); }
}

@keyframes onb-float-d {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  45% { transform: translate(20px, -12px) rotate(180deg); }
  80% { transform: translate(-26px, 12px) rotate(320deg); }
}

@keyframes onb-float-e {
  0%, 100% { transform: translate(0, 0) rotate(-14deg); }
  40% { transform: translate(-12px, 16px) rotate(30deg); }
  80% { transform: translate(16px, -10px) rotate(74deg); }
}

@keyframes onb-float-f {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  55% { transform: translate(-16px, 20px) rotate(300deg) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .onb-bg-layer .onb-shape {
    animation: none !important;
  }
}

/* =============================================================================
   CSS-Only Sliding Toggle Components
   ============================================================================= */

/* Entry Type Toggle (3 options) */
.entry-type-toggle {
  --button-1-width: 100px;  /* Will be set by JavaScript */
  --button-2-width: 100px;  /* Will be set by JavaScript */
  --button-3-width: 100px;  /* Will be set by JavaScript */
  --button-1-left: 4px;     /* Will be set by JavaScript */
  --button-2-left: 108px;   /* Will be set by JavaScript */
  --button-3-left: 212px;   /* Will be set by JavaScript */
}

.entry-type-toggle .entry-type-slider {
  left: var(--button-1-left);
  width: var(--button-1-width);
  /* No transition by default - will be added by JavaScript after first interaction */
}

/* Only add transition after user has interacted */
.entry-type-toggle.transitions-enabled .entry-type-slider {
  transition: all 0.3s ease-out;
}

/* Position slider based on which radio is checked */
.entry-type-toggle input[type="radio"]:nth-of-type(1):checked ~ .entry-type-slider {
  transform: translateX(0);
  width: var(--button-1-width);
}

.entry-type-toggle input[type="radio"]:nth-of-type(2):checked ~ .entry-type-slider {
  transform: translateX(calc(var(--button-2-left) - var(--button-1-left)));
  width: var(--button-2-width);
}

.entry-type-toggle input[type="radio"]:nth-of-type(3):checked ~ .entry-type-slider {
  transform: translateX(calc(var(--button-3-left) - var(--button-1-left)));
  width: var(--button-3-width);
}

/* List/Grid Toggle (2 options) */
.list-grid-toggle {
  --button-1-width: 80px;   /* Will be set by JavaScript */
  --button-2-width: 80px;   /* Will be set by JavaScript */
  --button-1-left: 4px;     /* Will be set by JavaScript */
  --button-2-left: 88px;    /* Will be set by JavaScript */
}

.list-grid-toggle .toggle-slider {
  left: var(--button-1-left);
  width: var(--button-1-width);
  /* No transition by default - will be added by JavaScript after first interaction */
}

/* Only add transition after user has interacted */
.list-grid-toggle.transitions-enabled .toggle-slider {
  transition: all 0.3s ease-out;
}

.list-grid-toggle input[type="radio"]:nth-of-type(1):checked ~ .toggle-slider {
  transform: translateX(0);
  width: var(--button-1-width);
}

.list-grid-toggle input[type="radio"]:nth-of-type(2):checked ~ .toggle-slider {
  transform: translateX(calc(var(--button-2-left) - var(--button-1-left)));
  width: var(--button-2-width);
}

/* View Toggle (List/Timeline - 2 options) */
.view-toggle {
  --button-1-width: 80px;   /* Will be set by JavaScript */
  --button-2-width: 80px;   /* Will be set by JavaScript */
  --button-1-left: 4px;     /* Will be set by JavaScript */
  --button-2-left: 88px;    /* Will be set by JavaScript */
}

.view-toggle .toggle-slider {
  left: var(--button-1-left);
  width: var(--button-1-width);
  /* No transition by default - will be added by JavaScript after first interaction */
}

/* Only add transition after user has interacted */
.view-toggle.transitions-enabled .toggle-slider {
  transition: all 0.3s ease-out;
}

.view-toggle input[type="radio"]:nth-of-type(1):checked ~ .toggle-slider {
  transform: translateX(0);
  width: var(--button-1-width);
}

.view-toggle input[type="radio"]:nth-of-type(2):checked ~ .toggle-slider {
  transform: translateX(calc(var(--button-2-left) - var(--button-1-left)));
  width: var(--button-2-width);
}

/* Common styles for all toggles */
.css-toggle-button {
  user-select: none;
}

.css-toggle-button:focus-within {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Ensure radio inputs remain hidden but accessible */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* =============================================================================
   Flash Message Animations
   ============================================================================= */

@keyframes slide-in-right {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.animate-slide-in-right {
  animation: slide-in-right 0.3s ease-out forwards;
}

/* =============================================================================
   Fade Out Animation (for status indicators)
   ============================================================================= */

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.animate-fadeOut {
  animation: fadeOut 2s ease-out forwards;
}

/* =============================================================================
   iOS-style Toggle Switch
   ============================================================================= */

.ios-toggle {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.ios-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db; /* gray-300 */
  transition: 0.3s;
  border-radius: 31px;
}

.ios-toggle-slider:before {
  position: absolute;
  content: "";
  height: 25px;
  width: 25px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ios-toggle input:checked + .ios-toggle-slider {
  background-color: #2563eb; /* blue-600 */
}

.ios-toggle input:focus + .ios-toggle-slider {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ios-toggle input:checked + .ios-toggle-slider:before {
  transform: translateX(20px);
}

  /* Spacing Scale */
  --section-spacing: 4rem;          /* py-16 equivalent */
  --section-spacing-mobile: 3rem;   /* py-12 equivalent */
  --card-padding: 1.5rem;           /* p-6 equivalent */
  --component-gap: 1.5rem;          /* gap-6 equivalent */

  /* Typography */
  --heading-color: var(--gray-900);
  --body-color: var(--gray-600);
  --secondary-color: var(--gray-500);

  /* Component Styles */
  --border-radius-md: 0.375rem;     /* rounded-md */
  --border-radius-lg: 0.5rem;       /* rounded-lg */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-default: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --transition-default: all 0.2s ease-in-out;
  --focus-ring: 0 0 0 2px var(--primary-600), 0 0 0 4px rgb(59 130 246 / 0.1);
}

/* =============================================================================
   Base Component Classes
   ============================================================================= */

/* Card Base Class */
.card-base {
  background-color: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

/* Button Base Classes */
.btn-primary {
  background-color: var(--primary-600);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  transition: var(--transition-default);
  border: 1px solid transparent;
}

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

.btn-primary:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-secondary {
  background-color: white;
  color: var(--gray-700);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  transition: var(--transition-default);
  border: 1px solid var(--gray-300);
}

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

.btn-secondary:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Icon Size Standards */
.icon-sm { width: 1rem; height: 1rem; }      /* h-4 w-4 */
.icon-md { width: 1.25rem; height: 1.25rem; } /* h-5 w-5 */
.icon-lg { width: 1.5rem; height: 1.5rem; }   /* h-6 w-6 */

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

/* Consistent focus states */
.focus-ring:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Semantic focus states */
.focus-ring-success:focus {
  box-shadow: 0 0 0 2px var(--success-600), 0 0 0 4px rgb(22 163 74 / 0.1);
}

.focus-ring-warning:focus {
  box-shadow: 0 0 0 2px var(--warning-600), 0 0 0 4px rgb(202 138 4 / 0.1);
}

.focus-ring-error:focus {
  box-shadow: 0 0 0 2px var(--error-600), 0 0 0 4px rgb(220 38 38 / 0.1);
}

/* =============================================================================
   Pagy Pagination Styling
   ============================================================================= */

/* Pagy nav wrapper styling */
nav[aria-label="Pagination"] {
  display: inline-flex;
  border-radius: 0.375rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

nav[aria-label="Pagination"] a,
nav[aria-label="Pagination"] span {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #d1d5db;
  background-color: white;
  color: #374151;
  text-decoration: none;
  margin-left: -1px;
  transition: all 0.2s ease-in-out;
}

nav[aria-label="Pagination"] a:hover {
  background-color: #f9fafb;
  color: #111827;
}

nav[aria-label="Pagination"] a:focus {
  z-index: 10;
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

/* Current page styling */
nav[aria-label="Pagination"] span.current {
  z-index: 10;
  background-color: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  font-weight: 600;
}

/* Disabled/gap state */
nav[aria-label="Pagination"] span.gap {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: default;
}

/* First child rounded corners */
nav[aria-label="Pagination"] a:first-child,
nav[aria-label="Pagination"] span:first-child {
  margin-left: 0;
  border-top-left-radius: 0.375rem;
  border-bottom-left-radius: 0.375rem;
}

/* Last child rounded corners */
nav[aria-label="Pagination"] a:last-child,
nav[aria-label="Pagination"] span:last-child {
  border-top-right-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
}

/* =============================================================================
   Form Elements - Better Select Styling
   ============================================================================= */

/* Enhanced select styling with better chevron positioning */
select.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em 1.25em;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 3rem; /* Ensures text never overlaps with chevron */
}
