/* Animation styles for modal transitions */

/* Modal Animations */
.animate-backdrop-fade-in {
  animation: backdropFadeIn 0.25s ease forwards;
}

.animate-backdrop-fade-out {
  animation: backdropFadeOut 0.2s ease forwards;
}

.animate-modal-scale-in {
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-modal-enter {
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-modal-exit {
  animation: modalExit 0.2s ease-in forwards;
}

.animate-modal-slide-in-right {
  animation: modalSlideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-modal-exit-right {
  animation: modalExitRight 0.2s ease-in forwards;
}

/* Modal backdrop keyframes */
@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Modal content keyframes */
@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes modalSlideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes modalExitRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

/* Simple fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal slide in from bottom with scale */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow-y: auto;
  z-index: 50;
}

/* Position variants */
.modal-overlay--center {
  align-items: center;
  justify-content: center;
}

.modal-overlay--right {
  justify-content: flex-end;
  padding: 0;
}

/* Modal container */
.modal {
  position: relative;
  /* Allow width to be controlled by passed Tailwind classes (e.g., w-[70%], w-3/5) */
  width: auto;
  background-color: var(--bg-primary);
  border-radius: var(--border-radius-xl);
  /* Add a clearer drop shadow for better edge visibility */
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 10px 20px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Right position variant */
.modal--right {
  height: 100%;
  border-radius: 0;
}

/* Header */
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-primary);
}

.modal__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.modal__close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  background-color: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--border-radius-md);
  transition: background-color 150ms ease;
}

.modal__close-button:hover {
  background-color: var(--bg-secondary);
}

/* Content */
.modal__content {
  overflow-y: auto;
  max-height: calc(100vh - 16rem);
}

.modal__content--padded {
  padding: var(--space-6);
}

/* Footer */
.modal__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-primary);
}

/* Animation classes are defined in src/design-system/styles/animations.css */

/* Dark mode forced */
.modal--dark {
  background-color: var(--color-gray-900);
  color: var(--color-white);
}

.modal--dark .modal__header {
  border-bottom-color: var(--color-gray-700);
}

.modal--dark .modal__footer {
  border-top-color: var(--color-gray-700);
}

/* Static mode */
.modal--static {
  position: relative;
  box-shadow: none;
}

/* Additional classes */
.modal-container {
  display: flex;
  flex-direction: column;
}

.modal-contextual {
  /* Contextual modals have automatic height */
  height: auto;
}

/* iOS-specific border radius */
.ios-modal-radius {
  border-radius: var(--border-radius-xl);
}

/* Hide scrollbar */
.scrollbar-hide {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Body scroll lock */
body.modal-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}
:root {
  /* Fallback tokens if not provided elsewhere */
  --glass-bg-light: #ffffff; /* solid white for light mode */
  --glass-bg-dark: rgba(18, 18, 18, 0.68);
  --glass-stroke: rgba(0, 0, 0, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.6);
  --shadow-ambient: 0 10px 30px rgba(0, 0, 0, 0.12);
  --txt-primary: #0f172a;
  --txt-secondary: rgba(15, 23, 42, 0.7);
  --ok: #22c55e;
  --bad: #ef4444;
}

/* Remove grain entirely in light mode for a clean white sheet */
.ModalGlass_sheet__xrCXH[data-theme='light']::after {
  content: none;
}

/* Ensure internal panels render white in light mode even without data-theme on the panel */
.ModalGlass_sheet__xrCXH[data-theme='light'] .ModalGlass_panel__\+c9gI {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
}
.ModalGlass_sheet__xrCXH[data-theme='light'] .ModalGlass_divider__8g5\+E {
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.06),
    rgba(0,0,0,0.03)
  );
}

/* Backdrop behind the modal */
.ModalGlass_backdrop__aLOYg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Flex frame controlling alignment (center vs right panel) */
.ModalGlass_frameCenter__-TQN9 {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  min-height: 0; /* allow child to compute height correctly */
}

.ModalGlass_frameRight__RddIU {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 16px;
  box-sizing: border-box;
  min-height: 0; /* allow child to compute height correctly */
}

/* Glass sheet container */
.ModalGlass_sheet__xrCXH {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto; /* header, body, footer */
  overflow: hidden; /* clip rounded corners; body handles scrolling */
  box-sizing: border-box;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border: 1px solid var(--glass-stroke);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  box-shadow: var(--shadow-ambient);
  /* Default to light mode (no blur) to prevent flickering */
  background: #ffffff;
  color: #0f172a;
  color: var(--txt-primary);
}

.ModalGlass_sheet__xrCXH[data-theme='dark'] {
  background: rgba(18, 18, 18, 0.68);
  background: var(--glass-bg-dark);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  color: rgba(255,255,255,0.92);
}

/* Light theme: ensure no backdrop filter (explicit override if needed) */
.ModalGlass_sheet__xrCXH[data-theme='light'] {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #0f172a;
  color: var(--txt-primary);
}

/* Specular highlight line at top */
/* Removed specular top highlight to prevent rendering seams on some GPUs/browsers */
.ModalGlass_sheet__xrCXH::before {
  content: none;
}

/* Very faint grain */
/* Removed faint grain overlay (can cause subtle vertical lines with backdrop-filter) */
.ModalGlass_sheet__xrCXH::after {
  content: none;
}

/* Sticky header/footer */
.ModalGlass_header__UjxGU {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 5; /* ensure above scrolling content */
  padding: 14px 20px;
  background: inherit; /* solid background so content doesn't show through */
  /* subtle divider below header */
  box-shadow: 0 1px 0 color-mix(in oklab, #000 16%, transparent);
}

.ModalGlass_title__5NA9N {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  color: #0f172a;
  color: var(--txt-primary);
}

.ModalGlass_sheet__xrCXH[data-theme='dark'] .ModalGlass_title__5NA9N {
  color: rgba(255,255,255,0.92);
}

.ModalGlass_content__nwAeb {
  /* Allow body to take remaining space; scroll happens on the sheet */
  flex: 1 1 auto;
  min-height: 0;
  /* extra bottom padding so last fields aren't hidden behind sticky footer */
  padding: 24px 24px 140px; /* footer height + spacing */
  scroll-padding-bottom: 140px; /* keep focused inputs above footer */
  scroll-padding-top: 64px; /* keep first focus below header */
  overflow-y: auto; /* body is the scroll container */
  -webkit-overflow-scrolling: touch; /* smooth iOS scrolling */
  overscroll-behavior: contain;
  position: relative;
}
.ModalGlass_contentNoPad__Om6Sa {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 24px 140px;
  scroll-padding-bottom: 140px;
  scroll-padding-top: 64px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  position: relative;
}

/* Compact content for short, centered modals to avoid excessive empty space */
.ModalGlass_contentCompact__iCyxF {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 24px 72px; /* smaller bottom padding than full content */
  scroll-padding-bottom: 80px;
  scroll-padding-top: 56px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  position: relative;
}

.ModalGlass_footer__05Um- {
  position: -webkit-sticky;
  position: sticky;
  bottom: 0;
  z-index: 5; /* ensure above scrolling content */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 20px;
  background: inherit;
  /* subtle divider above footer */
  box-shadow: 0 -1px 0 color-mix(in oklab, #000 16%, transparent);
}

/* Size presets (used for right-positioned wide modals) */
.ModalGlass_width50__B-oiQ { width: min(960px, 50vw); }
.ModalGlass_width60__HpqZE { width: min(1056px, 60vw); }
.ModalGlass_width70__0msl\+ { width: min(1200px, 70vw); }
.ModalGlass_full__aZadK    { width: 100%; max-width: 100%; }
.ModalGlass_contextual__mFSDV { width: 100%; max-width: 640px; }
.ModalGlass_heightScreen__aKWvj {
  /* Fill the padded frame completely and never exceed it */
  height: 100%;
  max-height: 100%;
}

/* Auto-height for contextual, center modals: size to content with a comfortable cap */
.ModalGlass_heightAuto__AsElO {
  height: auto;
  /* Ensure the modal never exceeds the viewport minus the frame padding */
  max-height: min(85vh, calc(100vh - 32px));
}

/* Mobile full-screen override for ALL modals */
@media (max-width: 640px) {
  .ModalGlass_frameCenter__-TQN9,
  .ModalGlass_frameRight__RddIU {
    padding: 0;          /* remove margins around the modal */
  }
  .ModalGlass_sheet__xrCXH {
    width: 100vw;        /* full width */
    height: 100vh;       /* full height */
    max-width: none;
    max-height: none;
    border-radius: 0;    /* edge-to-edge */
  }
}

/* Panels inside modal (sections) */
.ModalGlass_panel__\+c9gI {
  background: rgba(22,22,22,0.82);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
}

.ModalGlass_panel__\+c9gI[data-theme='light'] {
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(0,0,0,0.08);
}

/* Etched divider (can be added to rows inside panels) */
.ModalGlass_divider__8g5\+E {
  height: 1px;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.10),
    rgba(255,255,255,0.04)
  );
}

/* Image scrims */
.ModalGlass_scrimTop__sWtca {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 96px;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0));
  pointer-events: none;
}

.ModalGlass_scrimBottom__A6foK {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 160px;
  background: linear-gradient(0deg, rgba(0,0,0,0.55), rgba(0,0,0,0));
  pointer-events: none;
}

/* Reduced motion handling for entrance/exit animations; JS controls classes */
@media (prefers-reduced-motion: reduce) {
  .ModalGlass_reduceMotion__fQA3H {
    animation: none !important;
    transition: none !important;
  }
}

/* BottomSheet backdrop */
.bottom-sheet__backdrop {
  position: fixed;
  inset: 0;
  z-index: 70000;
  display: flex;
  min-height: 100vh;
  width: 100%;
  align-items: flex-end;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

@media (min-width: 640px) {
  .bottom-sheet__backdrop {
    align-items: center;
  }
}

/* BottomSheet content */
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70001;
  width: 100%;
  border-top-left-radius: var(--border-radius-xl);
  border-top-right-radius: var(--border-radius-xl);
  background-color: var(--bg-primary);
  padding: var(--space-3);
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  transition: transform 500ms ease-out;
}

.bottom-sheet--dragging {
  transition: none;
}

.bottom-sheet--visible {
  transform: translateY(0);
}

.bottom-sheet--hidden {
  transform: translateY(100%);
}

/* Drag area */
.bottom-sheet__drag-area {
  cursor: grab;
  touch-action: none;
  padding-bottom: var(--space-3);
}

.bottom-sheet__drag-area:active {
  cursor: grabbing;
}

/* Grabber handle */
.bottom-sheet__grabber {
  margin: 0 auto var(--space-3);
  height: 0.25rem;
  width: 2.5rem;
  border-radius: var(--border-radius-full);
  background-color: var(--color-gray-300);
}

.dark .bottom-sheet__grabber {
  background-color: var(--color-gray-700);
}

/* Header */
.bottom-sheet__header {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-1);
}

.bottom-sheet__title {
  flex-grow: 1;
  text-align: center;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

/* Dropdown container */
.dropdown {
  position: relative;
}

.dropdown__trigger {
  cursor: pointer;
}

/* Desktop dropdown menu */
.dropdown__menu {
  position: absolute;
  z-index: 50;
  margin-top: var(--space-1);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-primary);
  background-color: var(--bg-primary);
  padding: var(--space-1) 0;
  box-shadow: var(--shadow-lg);
  overflow-x: hidden;
  display: block;
}

/* Width variants */
.dropdown__menu--auto {
  min-width: 180px;
}

.dropdown__menu--sm {
  width: 12rem;
}

.dropdown__menu--md {
  width: 14rem;
}

.dropdown__menu--lg {
  width: 16rem;
}

.dropdown__menu--xl {
  width: 18rem;
}

.dropdown__menu--full {
  width: 100%;
}

/* Alignment variants */
.dropdown__menu--left {
  left: 0;
}

.dropdown__menu--right {
  right: 0;
}

.dropdown__menu--center {
  left: 50%;
  transform: translateX(-50%);
}

/* Dropdown Item */
.dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  text-align: left;
  transition: background-color 150ms ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: none;
  background: transparent;
  cursor: pointer;
}

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

.dropdown-item--enabled:hover {
  background-color: var(--bg-secondary);
}

.dropdown-item--disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.dropdown-item__icon {
  margin-right: var(--space-2);
  flex-shrink: 0;
}

.dropdown-item__content {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

/* Dropdown Divider */
.dropdown-divider {
  margin: var(--space-1) 0;
  border-top: 1px solid var(--border-primary);
}

/* Mobile styles */
.dropdown--mobile .dropdown__content {
  padding: var(--space-1) var(--space-2);
  gap: var(--space-2);
}

.dropdown--mobile .dropdown__cancel-button {
  margin-top: var(--space-3);
  display: block;
  width: 100%;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-gray-700);
  background-color: var(--color-black);
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-300);
  cursor: pointer;
  transition: opacity 150ms ease;
}

.dropdown--mobile .dropdown__cancel-button:hover {
  opacity: 0.9;
}

/* Hide scrollbar */
.dropdown__menu {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.dropdown__menu::-webkit-scrollbar {
  display: none;
}

.dropdown {
  position: relative;
  width: 100%;
  overflow: visible;
}

.dropdown--disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.dropdown__trigger {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--border-radius-lg);
  background-color: transparent;
  /* Subtle inner stroke to read on glass */
  box-shadow: inset 0 0 0 1px var(--border-primary);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
  position: relative;
  overflow: hidden;
}

.dropdown__trigger:hover:not(:disabled) {
  box-shadow: inset 0 0 0 1px var(--border-secondary);
}

.dropdown__trigger:focus {
  outline: none;
  border-color: transparent;
  /* Use info color to enforce blue ring */
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), inset 0 0 0 1px var(--color-info-500);
}

.dropdown__trigger:disabled {
  cursor: not-allowed;
  background-color: var(--bg-secondary);
}

.dropdown__trigger--open {
  border-color: transparent;
  /* Use info color to enforce blue ring when open */
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), inset 0 0 0 1px var(--color-info-500);
}

.dropdown__label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}

.dropdown__value {
  flex: 1 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown__placeholder {
  color: var(--text-tertiary);
}

.dropdown__chevron {
  margin-left: var(--space-2);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  transition: transform 150ms ease;
  color: var(--text-secondary);
}

.dropdown__chevron--open {
  transform: rotate(180deg);
}

/* Ensure SVG chevron stays within bounds */
.dropdown__trigger svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

/* Dropdown menu (portal) */
.dropdown__menu {
  position: fixed;
  z-index: 60001; /* Above modal z-index */
  max-height: 300px;
  overflow: auto;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  overscroll-behavior: contain;
}

.dropdown__menu--bottom {
  margin-top: var(--space-1);
}

.dropdown__menu--top {
  margin-bottom: var(--space-1);
}

.dropdown__search {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  padding: var(--space-2);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: var(--space-1);
}

.dropdown__search-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-md);
  background-color: var(--bg-primary);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.dropdown__search-input::placeholder {
  color: var(--text-tertiary);
}

.dropdown__search-input:focus {
  outline: none;
  border-color: var(--color-info-500);
}

.dropdown__option {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background-color: transparent;
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: background-color 150ms ease;
  min-height: var(--pwa-touch-target-min);
}

.dropdown__option:hover {
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius-md) !important;
}

.dropdown__option:focus {
  outline: none;
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius-md) !important;
}

.dropdown__option--selected {
  /* Blue selection in light theme */
  background-color: var(--color-info-50);
  color: var(--color-info-700);
}

.dark .dropdown__option--selected {
  /* Deep blue selection in dark theme */
  background-color: var(--color-info-900);
  color: var(--color-info-200);
}

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

.dropdown__no-options {
  padding: var(--space-3);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
}

/* Divider for grouped options */
.dropdown__divider {
  height: 1px;
  margin: var(--space-1) 0;
  background-color: var(--border-primary);
}

/* Error state */
.dropdown--error .dropdown__trigger {
  border-color: var(--color-error);
}

.dropdown__error {
  margin-top: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--color-error);
}

.dropdown__required {
  color: var(--color-error);
  margin-left: var(--space-1);
}

/* Size variants */
.dropdown__trigger--sm {
  height: 2rem;
  font-size: var(--font-size-sm);
  padding: 0 var(--space-2);
}

.dropdown__trigger--md {
  height: 2.5rem;
  font-size: var(--font-size-base);
  padding: 0 var(--space-3);
}

.dropdown__trigger--lg {
  height: 3rem;
  font-size: var(--font-size-lg);
  padding: 0 var(--space-4);
}

/* Variant styles */
.dropdown__trigger--primary {
  border-color: var(--color-primary-300);
  background-color: var(--color-primary-50);
  color: var(--color-primary-900);
}

.dark .dropdown__trigger--primary {
  border-color: var(--color-primary-600);
  background-color: rgba(59, 130, 246, 0.1);
  background-color: var(--color-info-500-10, rgba(59, 130, 246, 0.1));
  color: var(--color-primary-100);
}

.dropdown__trigger--danger {
  border-color: var(--color-error-300);
  background-color: var(--color-error-50);
  color: var(--color-error-900);
}

.dark .dropdown__trigger--danger {
  border-color: var(--color-error-600);
  background-color: var(--color-error-500-10);
  color: var(--color-error-100);
}

/* Auto width */
.dropdown__trigger--auto-width {
  width: auto;
}

/* Mobile clamping: keep menu within viewport and align with trigger width */
@media (max-width: 640px) {
  .dropdown__menu {
    max-width: calc(100vw - 16px); /* 8px gutters on both sides */
    border-radius: 12px;
  }
}

.form-field {
  width: 100%;
}

.form-field--error {
  border-color: var(--color-error);
}

.form-field__inline-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.form-field__input-wrapper {
  flex: 1 1;
}

.form-field__additional-content {
  margin-top: var(--space-2);
  display: flex;
  justify-content: flex-end;
}

.form-field__error {
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-error);
}

.color-category {
  margin-bottom: var(--space-8);
}

.color-category__title {
  margin-bottom: var(--space-4);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

.color-category__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-gap: var(--space-4);
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .color-category__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .color-category__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.component-section {
  margin-bottom: var(--space-12);
  border-radius: var(--border-radius-lg);
  background-color: var(--bg-primary);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

.component-section__title {
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: var(--space-2);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.settings-panel {
  margin-bottom: var(--space-6);
}

.settings-panel__title {
  margin-bottom: var(--space-1);
  display: flex;
  align-items: center;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.settings-panel__description {
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

.settings-panel__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.invoice-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-primary);
  background-color: var(--bg-primary);
}

.invoice-card__header {
  border-bottom: 1px solid var(--border-primary);
  padding: var(--space-3);
}

.invoice-card__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.invoice-card__financial {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: var(--space-3);
}

.invoice-card__metric {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.invoice-card__metric--bordered {
  border-left: 1px solid var(--border-primary);
  border-right: 1px solid var(--border-primary);
}

.invoice-card__metric-label {
  margin-bottom: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.invoice-card__metric-value {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.invoice-card__metric-value--profit {
  color: var(--color-success-500);
}

.invoice-card__metric-value--loss {
  color: var(--color-error);
}

.invoice-header {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.invoice-header:hover {
  background-color: var(--bg-tertiary);
}

@media (min-width: 640px) {
  .invoice-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
  }
}

/* Left side content */
.invoice-header__left {
  display: flex;
  min-width: 0;
  flex: 1 1;
  align-items: center;
  gap: var(--space-3);
}

.invoice-header__expand-icon {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.invoice-header__info {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.invoice-header__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.invoice-header__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* Right side content */
.invoice-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Financial summary */
.invoice-header__financial {
  display: none;
  align-items: center;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .invoice-header__financial {
    display: flex;
  }
}

.invoice-header__financial-mobile {
  display: flex;
  text-align: right;
}

@media (min-width: 640px) {
  .invoice-header__financial-mobile {
    display: none;
  }
}

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

.invoice-header__metric-label {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.invoice-header__metric-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.invoice-header__metric-value--profit {
  color: var(--color-success-500);
}

.invoice-header__metric-value--loss {
  color: var(--color-error);
}

/* Action buttons */
.invoice-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  border-left: 1px solid var(--border-primary);
  padding-left: var(--space-4);
}

.invoice-header__action-button {
  padding: var(--space-2);
  color: var(--text-secondary);
}

.invoice-header__action-button:hover {
  color: var(--text-primary);
}

.invoice-header__action-button--delete:hover {
  color: var(--color-error);
}

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

