/* ============================================================
   ATOM.GUI.CSS — shadcn/ui-inspired component styles for Atom.js
   ============================================================ */

/* ── Theme Variables ──────────────────────────────────────── */
:root {
  --atom-bg:              #ffffff;
  --atom-fg:              #09090b;
  --atom-card-bg:         #ffffff;
  --atom-popover-bg:      #ffffff;
  --atom-primary:         #18181b;
  --atom-primary-fg:      #fafafa;
  --atom-secondary:       #f4f4f5;
  --atom-secondary-fg:    #18181b;
  --atom-muted:           #f4f4f5;
  --atom-muted-fg:        #71717a;
  --atom-accent:          #f4f4f5;
  --atom-accent-fg:       #18181b;
  --atom-destructive:     #ef4444;
  --atom-destructive-fg:  #fafafa;
  --atom-success:         #22c55e;
  --atom-success-fg:      #fafafa;
  --atom-warning:         #f59e0b;
  --atom-warning-fg:      #fafafa;
  --atom-border:          #e4e4e7;
  --atom-input-border:    #e4e4e7;
  --atom-ring:            #18181b;
  --atom-ring-offset:     #ffffff;
  --atom-radius:          0.5rem;
  --atom-radius-sm:       0.25rem;
  --atom-radius-md:       0.375rem;
  --atom-radius-lg:       0.75rem;
  --atom-radius-xl:       1rem;
  --atom-radius-full:     9999px;
  --atom-font:            ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --atom-font-mono:       ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --atom-shadow-sm:       0 1px 2px 0 rgb(0 0 0 / 0.05);
  --atom-shadow:          0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --atom-shadow-md:       0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --atom-shadow-lg:       0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --atom-shadow-xl:       0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --atom-transition:      0.15s ease;
}

/* ── Base / Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

.atom-gui * {
  font-family: var(--atom-font);
}

/* ============================================================
   BUTTON
   ============================================================ */
.atom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--atom-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  transition: background-color var(--atom-transition), color var(--atom-transition), border-color var(--atom-transition), box-shadow var(--atom-transition), opacity var(--atom-transition);
  cursor: pointer;
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
  font-family: var(--atom-font);
  user-select: none;
  -webkit-user-select: none;
}
.atom-btn:focus-visible {
  outline: 2px solid var(--atom-ring);
  outline-offset: 2px;
}
.atom-btn:disabled,
.atom-btn[disabled] {
  pointer-events: none;
  opacity: 0.5;
}

/* Sizes */
.atom-btn-sm  { height: 2rem;    padding: 0 0.75rem; font-size: 0.8125rem; border-radius: var(--atom-radius-md); }
.atom-btn-md  { height: 2.25rem; padding: 0 1rem; }
.atom-btn-lg  { height: 2.5rem;  padding: 0 1.5rem; font-size: 1rem; }
.atom-btn-icon { height: 2.25rem; width: 2.25rem; padding: 0; }

/* Variants */
.atom-btn-primary {
  background-color: var(--atom-primary);
  color: var(--atom-primary-fg);
  border-color: var(--atom-primary);
}
.atom-btn-primary:hover:not(:disabled) { background-color: #27272a; }

.atom-btn-secondary {
  background-color: var(--atom-secondary);
  color: var(--atom-secondary-fg);
}
.atom-btn-secondary:hover:not(:disabled) { background-color: #e4e4e7; }

.atom-btn-destructive {
  background-color: var(--atom-destructive);
  color: var(--atom-destructive-fg);
}
.atom-btn-destructive:hover:not(:disabled) { background-color: #dc2626; }

.atom-btn-outline {
  background-color: transparent;
  color: var(--atom-fg);
  border-color: var(--atom-border);
}
.atom-btn-outline:hover:not(:disabled) {
  background-color: var(--atom-accent);
  color: var(--atom-accent-fg);
}

.atom-btn-ghost {
  background-color: transparent;
  color: var(--atom-fg);
  border-color: transparent;
}
.atom-btn-ghost:hover:not(:disabled) {
  background-color: var(--atom-accent);
  color: var(--atom-accent-fg);
}

.atom-btn-link {
  background-color: transparent;
  color: var(--atom-primary);
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.atom-btn-link:hover:not(:disabled) { opacity: 0.8; }

/* ============================================================
   BADGE
   ============================================================ */
.atom-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: var(--atom-radius-full);
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: var(--atom-font);
}
.atom-badge-default     { background-color: var(--atom-primary);    color: var(--atom-primary-fg);    border-color: var(--atom-primary); }
.atom-badge-secondary   { background-color: var(--atom-secondary);  color: var(--atom-secondary-fg);  border-color: var(--atom-secondary); }
.atom-badge-destructive { background-color: var(--atom-destructive);color: var(--atom-destructive-fg);border-color: var(--atom-destructive); }
.atom-badge-success     { background-color: var(--atom-success);    color: var(--atom-success-fg);    border-color: var(--atom-success); }
.atom-badge-warning     { background-color: var(--atom-warning);    color: var(--atom-warning-fg);    border-color: var(--atom-warning); }
.atom-badge-outline     { background-color: transparent;            color: var(--atom-fg);            border-color: var(--atom-border); }
.atom-badge-ghost       { background-color: var(--atom-muted);      color: var(--atom-muted-fg);      border-color: transparent; }

/* ============================================================
   ALERT
   ============================================================ */
.atom-alert {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  align-items: start;
  padding: 1rem;
  border-radius: var(--atom-radius);
  border: 1px solid var(--atom-border);
  background-color: var(--atom-bg);
  font-family: var(--atom-font);
}
.atom-alert > svg:first-child {
  grid-row: 1 / 3;
  margin-top: 0.1rem;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.atom-alert-title {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.01em;
}
.atom-alert-description {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--atom-muted-fg);
  margin: 0;
}
.atom-alert-action {
  grid-column: 2;
  margin-top: 0.5rem;
}

/* Variants */
.atom-alert-default     { background-color: var(--atom-bg);          border-color: var(--atom-border); }
.atom-alert-destructive {
  background-color: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}
.atom-alert-destructive .atom-alert-description { color: #b91c1c; }
.atom-alert-success {
  background-color: #f0fdf4;
  border-color: #86efac;
  color: #14532d;
}
.atom-alert-success .atom-alert-description { color: #166534; }
.atom-alert-warning {
  background-color: #fffbeb;
  border-color: #fcd34d;
  color: #78350f;
}
.atom-alert-warning .atom-alert-description { color: #92400e; }

/* ============================================================
   AVATAR
   ============================================================ */
.atom-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--atom-radius-full);
  overflow: hidden;
  background-color: var(--atom-muted);
  color: var(--atom-muted-fg);
  font-family: var(--atom-font);
  flex-shrink: 0;
  position: relative;
}
.atom-avatar-sm      { width: 2rem;    height: 2rem;    font-size: 0.75rem; }
.atom-avatar-default { width: 2.5rem;  height: 2.5rem;  font-size: 0.875rem; }
.atom-avatar-lg      { width: 3rem;    height: 3rem;    font-size: 1rem; }
.atom-avatar-xl      { width: 4rem;    height: 4rem;    font-size: 1.25rem; }

.atom-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.atom-avatar-fallback {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================
   ACCORDION
   ============================================================ */
.atom-accordion {
  display: flex;
  flex-direction: column;
  width: 100%;
  font-family: var(--atom-font);
}
.atom-accordion-item {
  border-bottom: 1px solid var(--atom-border);
}
.atom-accordion-item:last-child { border-bottom: none; }

.atom-accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--atom-fg);
  gap: 0.5rem;
  transition: color var(--atom-transition);
  font-family: var(--atom-font);
}
.atom-accordion-trigger:hover { color: var(--atom-primary); }
.atom-accordion-trigger:focus-visible {
  outline: 2px solid var(--atom-ring);
  outline-offset: 2px;
  border-radius: var(--atom-radius-sm);
}
.atom-accordion-trigger-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s ease;
  display: inline-block;
}
.atom-accordion-trigger-icon::before {
  content: "▾";
  font-size: 0.75rem;
}
.atom-accordion-item-open .atom-accordion-trigger-icon {
  transform: rotate(180deg);
}

.atom-accordion-content-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.2s ease;
  overflow: hidden;
}
.atom-accordion-item-open .atom-accordion-content-wrapper {
  grid-template-rows: 1fr;
}
.atom-accordion-content-inner {
  overflow: hidden;
}
.atom-accordion-content {
  padding: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--atom-muted-fg);
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.atom-breadcrumb { font-family: var(--atom-font); }
.atom-breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
}
.atom-breadcrumb-item { display: inline-flex; align-items: center; gap: 0.375rem; }
.atom-breadcrumb-link {
  color: var(--atom-muted-fg);
  text-decoration: none;
  transition: color var(--atom-transition);
}
.atom-breadcrumb-link:hover { color: var(--atom-fg); }
.atom-breadcrumb-page {
  color: var(--atom-fg);
  font-weight: 500;
}
.atom-breadcrumb-separator {
  color: var(--atom-muted-fg);
  opacity: 0.5;
  user-select: none;
}
.atom-breadcrumb-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  color: var(--atom-muted-fg);
  cursor: pointer;
}
.atom-breadcrumb-ellipsis:hover { color: var(--atom-fg); }

/* ============================================================
   CARD
   ============================================================ */
.atom-card {
  background-color: var(--atom-card-bg);
  border: 1px solid var(--atom-border);
  border-radius: var(--atom-radius-lg);
  box-shadow: var(--atom-shadow-sm);
  overflow: hidden;
  font-family: var(--atom-font);
}
.atom-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem;
  padding-bottom: 0;
}
.atom-card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.atom-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--atom-fg);
}
.atom-card-description {
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
  margin: 0;
  line-height: 1.5;
}
.atom-card-actions { display: flex; gap: 0.5rem; }
.atom-card-body,
.atom-card-content { padding: 1.5rem; }
.atom-card-footer {
  padding: 1.5rem;
  padding-top: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   CHECKBOX
   ============================================================ */
.atom-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: var(--atom-font);
  user-select: none;
  -webkit-user-select: none;
}
.atom-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--atom-primary);
  border-radius: var(--atom-radius-sm);
  background-color: var(--atom-bg);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background-color var(--atom-transition), border-color var(--atom-transition);
}
.atom-checkbox input[type="checkbox"]:checked {
  background-color: var(--atom-primary);
  border-color: var(--atom-primary);
}
.atom-checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0px;
  width: 4px;
  height: 8px;
  border: 2px solid var(--atom-primary-fg);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.atom-checkbox input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--atom-ring);
  outline-offset: 2px;
}
.atom-checkbox input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.atom-checkbox span { color: var(--atom-fg); line-height: 1.4; }

/* ============================================================
   COLLAPSIBLE
   ============================================================ */
.atom-collapsible { width: 100%; font-family: var(--atom-font); }
.atom-collapsible-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
}
.atom-collapsible-content-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.2s ease;
  overflow: hidden;
}
.atom-collapsible-open .atom-collapsible-content-wrapper {
  grid-template-rows: 1fr;
}
.atom-collapsible-content-inner { overflow: hidden; }
.atom-collapsible-content { padding-top: 0.5rem; }

/* ============================================================
   DIALOG / MODAL
   ============================================================ */
.atom-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgb(0 0 0 / 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: atom-fade-in 0.15s ease;
}
.atom-modal {
  background-color: var(--atom-bg);
  border: 1px solid var(--atom-border);
  border-radius: var(--atom-radius-lg);
  box-shadow: var(--atom-shadow-xl);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow: auto;
  animation: atom-zoom-in 0.15s ease;
  font-family: var(--atom-font);
}
.atom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 0;
}
.atom-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--atom-fg);
}
.atom-modal-description {
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
  padding: 0.25rem 1.5rem 0;
  margin: 0;
}
.atom-modal-body { padding: 1.5rem; }
.atom-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.5rem 1.5rem;
}

/* ============================================================
   ALERT DIALOG
   ============================================================ */
.atom-alert-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgb(0 0 0 / 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: atom-fade-in 0.15s ease;
}
.atom-alert-dialog {
  background-color: var(--atom-bg);
  border: 1px solid var(--atom-border);
  border-radius: var(--atom-radius-lg);
  box-shadow: var(--atom-shadow-xl);
  width: 100%;
  max-width: 28rem;
  padding: 1.5rem;
  animation: atom-zoom-in 0.15s ease;
  font-family: var(--atom-font);
}
.atom-alert-dialog-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  color: var(--atom-fg);
}
.atom-alert-dialog-description {
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
  line-height: 1.5;
  margin: 0 0 1.25rem;
}
.atom-alert-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ============================================================
   DROPDOWN MENU
   ============================================================ */
.atom-dropdown {
  position: relative;
  display: inline-block;
  font-family: var(--atom-font);
}
.atom-dropdown-content {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  min-width: 12rem;
  background-color: var(--atom-popover-bg);
  border: 1px solid var(--atom-border);
  border-radius: var(--atom-radius-md);
  box-shadow: var(--atom-shadow-md);
  padding: 0.25rem;
  animation: atom-fade-in-scale 0.1s ease;
}
.atom-dropdown-align-end   { left: auto; right: 0; }
.atom-dropdown-align-start { left: 0; right: auto; }

.atom-dropdown-label {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--atom-muted-fg);
}
.atom-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  color: var(--atom-fg);
  cursor: pointer;
  border-radius: var(--atom-radius-sm);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background-color var(--atom-transition);
  font-family: var(--atom-font);
}
.atom-dropdown-item:hover, .atom-dropdown-item:focus {
  background-color: var(--atom-accent);
  outline: none;
}
.atom-dropdown-item:focus-visible { outline: 2px solid var(--atom-ring); outline-offset: -2px; }
.atom-dropdown-item-destructive { color: var(--atom-destructive); }
.atom-dropdown-item-destructive:hover { background-color: #fef2f2; }
.atom-dropdown-item-icon { width: 1rem; height: 1rem; opacity: 0.7; }
.atom-dropdown-item-shortcut {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--atom-muted-fg);
  font-family: var(--atom-font-mono);
}
.atom-dropdown-separator {
  height: 1px;
  background-color: var(--atom-border);
  margin: 0.25rem 0;
}
.atom-dropdown-group-label {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  color: var(--atom-muted-fg);
  font-weight: 600;
}

/* ============================================================
   FIELD (Label + Input wrapper)
   ============================================================ */
.atom-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-family: var(--atom-font);
}
.atom-field-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--atom-fg);
  line-height: 1.25;
}
.atom-field-hint {
  font-size: 0.8125rem;
  color: var(--atom-muted-fg);
  line-height: 1.4;
}
.atom-field-error {
  font-size: 0.8125rem;
  color: var(--atom-destructive);
  line-height: 1.4;
}

/* ============================================================
   INPUT
   ============================================================ */
.atom-input {
  display: flex;
  height: 2.25rem;
  width: 100%;
  border-radius: var(--atom-radius-md);
  border: 1px solid var(--atom-input-border);
  background-color: var(--atom-bg);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: var(--atom-fg);
  transition: border-color var(--atom-transition), box-shadow var(--atom-transition);
  outline: none;
  font-family: var(--atom-font);
  min-width: 0;
}
.atom-input::placeholder { color: var(--atom-muted-fg); }
.atom-input:focus {
  border-color: var(--atom-ring);
  box-shadow: 0 0 0 3px rgb(24 24 27 / 0.1);
}
.atom-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.atom-input-invalid {
  border-color: var(--atom-destructive);
}
.atom-input-invalid:focus {
  border-color: var(--atom-destructive);
  box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15);
}

/* ============================================================
   KBD (Keyboard Key)
   ============================================================ */
.atom-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem 0.375rem;
  border-radius: var(--atom-radius-sm);
  border: 1px solid var(--atom-border);
  background-color: var(--atom-muted);
  font-family: var(--atom-font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--atom-fg);
  box-shadow: 0 1px 0 1px var(--atom-border);
  white-space: nowrap;
}

/* ============================================================
   LABEL
   ============================================================ */
.atom-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--atom-fg);
  line-height: 1.25;
  cursor: default;
  font-family: var(--atom-font);
}
.atom-label[for] { cursor: pointer; }

/* ============================================================
   PAGINATION
   ============================================================ */
.atom-pagination {
  display: flex;
  align-items: center;
  font-family: var(--atom-font);
}
.atom-pagination-content {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.atom-pagination-item { display: inline-flex; }
.atom-pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--atom-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--atom-fg);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--atom-transition), border-color var(--atom-transition);
  background: none;
  font-family: var(--atom-font);
}
.atom-pagination-link:hover { background-color: var(--atom-accent); }
.atom-pagination-link-active {
  background-color: var(--atom-primary);
  color: var(--atom-primary-fg);
  border-color: var(--atom-primary);
}
.atom-pagination-link-active:hover { background-color: #27272a; }
.atom-pagination-prev,
.atom-pagination-next {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.625rem;
  height: 2.25rem;
  border-radius: var(--atom-radius-md);
  font-size: 0.875rem;
  color: var(--atom-fg);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--atom-transition);
  border: none;
  background: none;
  font-family: var(--atom-font);
}
.atom-pagination-prev:hover,
.atom-pagination-next:hover { background-color: var(--atom-accent); }
.atom-pagination-prev:disabled,
.atom-pagination-next:disabled { opacity: 0.5; pointer-events: none; }
.atom-pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
}

/* ============================================================
   POPOVER
   ============================================================ */
.atom-popover {
  position: relative;
  display: inline-block;
  font-family: var(--atom-font);
}
.atom-popover-content {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  width: 18rem;
  background-color: var(--atom-popover-bg);
  border: 1px solid var(--atom-border);
  border-radius: var(--atom-radius-md);
  box-shadow: var(--atom-shadow-md);
  padding: 1rem;
  animation: atom-fade-in-scale 0.1s ease;
}
.atom-popover-align-end   { left: auto; right: 0; }
.atom-popover-align-start { left: 0; right: auto; }
.atom-popover-align-center { left: 50%; transform: translateX(-50%); }

.atom-popover-header { margin-bottom: 0.75rem; }
.atom-popover-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0 0 0.25rem;
  color: var(--atom-fg);
}
.atom-popover-description {
  font-size: 0.8125rem;
  color: var(--atom-muted-fg);
  line-height: 1.4;
  margin: 0;
}

/* ============================================================
   PROGRESS
   ============================================================ */
.atom-progress {
  position: relative;
  height: 0.5rem;
  width: 100%;
  overflow: hidden;
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-secondary);
  font-family: var(--atom-font);
}
.atom-progress-bar {
  height: 100%;
  background-color: var(--atom-primary);
  border-radius: var(--atom-radius-full);
  transition: width 0.3s ease;
}
.atom-progress-bar-success     { background-color: var(--atom-success); }
.atom-progress-bar-destructive { background-color: var(--atom-destructive); }
.atom-progress-bar-warning     { background-color: var(--atom-warning); }

/* ============================================================
   RADIO GROUP
   ============================================================ */
.atom-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: var(--atom-font);
}
.atom-radio-group-horizontal { flex-direction: row; flex-wrap: wrap; }

.atom-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--atom-fg);
  user-select: none;
  -webkit-user-select: none;
}
.atom-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--atom-primary);
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-bg);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color var(--atom-transition);
}
.atom-radio input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-primary);
}
.atom-radio input[type="radio"]:focus-visible {
  outline: 2px solid var(--atom-ring);
  outline-offset: 2px;
}
.atom-radio input[type="radio"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   SCROLL AREA
   ============================================================ */
.atom-scroll-area {
  position: relative;
  overflow: auto;
  font-family: var(--atom-font);
}
.atom-scroll-area::-webkit-scrollbar { width: 8px; height: 8px; }
.atom-scroll-area::-webkit-scrollbar-track { background: transparent; }
.atom-scroll-area::-webkit-scrollbar-thumb {
  background-color: var(--atom-border);
  border-radius: var(--atom-radius-full);
  border: 2px solid var(--atom-bg);
}
.atom-scroll-area::-webkit-scrollbar-thumb:hover { background-color: var(--atom-muted-fg); }

/* ============================================================
   SELECT
   ============================================================ */
.atom-select {
  display: flex;
  height: 2.25rem;
  width: 100%;
  border-radius: var(--atom-radius-md);
  border: 1px solid var(--atom-input-border);
  background-color: var(--atom-bg);
  padding: 0 2rem 0 0.75rem;
  font-size: 0.875rem;
  color: var(--atom-fg);
  transition: border-color var(--atom-transition), box-shadow var(--atom-transition);
  outline: none;
  font-family: var(--atom-font);
  appearance: none;
  -webkit-appearance: none;
  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%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
  min-width: 0;
}
.atom-select:focus {
  border-color: var(--atom-ring);
  box-shadow: 0 0 0 3px rgb(24 24 27 / 0.1);
}
.atom-select:disabled { opacity: 0.5; cursor: not-allowed; }
.atom-select-invalid { border-color: var(--atom-destructive); }

/* ============================================================
   SEPARATOR
   ============================================================ */
.atom-separator {
  background-color: var(--atom-border);
  flex-shrink: 0;
}
.atom-separator-horizontal { height: 1px; width: 100%; margin: 0; }
.atom-separator-vertical   { width: 1px;  height: 100%; display: inline-block; }

/* ============================================================
   SHEET (Drawer / Side Panel)
   ============================================================ */
.atom-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgb(0 0 0 / 0.8);
  animation: atom-fade-in 0.2s ease;
}
.atom-sheet-overlay-closing {
  animation: atom-fade-out 0.2s ease forwards;
}
.atom-sheet {
  position: fixed;
  z-index: 50;
  background-color: var(--atom-bg);
  box-shadow: var(--atom-shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: auto;
  font-family: var(--atom-font);
}
.atom-sheet-right  { top: 0; right: 0; bottom: 0; width: 26rem; max-width: 90vw; animation: atom-slide-in-right 0.2s ease; }
.atom-sheet-left   { top: 0; left: 0;  bottom: 0; width: 26rem; max-width: 90vw; animation: atom-slide-in-left  0.2s ease; }
.atom-sheet-top    { top: 0; left: 0; right: 0; min-height: 25vh; animation: atom-slide-in-top    0.2s ease; }
.atom-sheet-bottom { bottom: 0; left: 0; right: 0; min-height: 25vh; animation: atom-slide-in-bottom 0.2s ease; }

.atom-sheet-right.atom-sheet-closing  { animation: atom-slide-out-right  0.2s ease forwards; }
.atom-sheet-left.atom-sheet-closing   { animation: atom-slide-out-left   0.2s ease forwards; }
.atom-sheet-top.atom-sheet-closing    { animation: atom-slide-out-top    0.2s ease forwards; }
.atom-sheet-bottom.atom-sheet-closing { animation: atom-slide-out-bottom 0.2s ease forwards; }

.atom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--atom-border);
}
.atom-sheet-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--atom-fg);
}
.atom-sheet-description {
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
  margin: 0;
}
.atom-sheet-body   { flex: 1; padding: 1.5rem; }
.atom-sheet-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--atom-border);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ============================================================
   SKELETON
   ============================================================ */
.atom-skeleton {
  border-radius: var(--atom-radius-md);
  background: linear-gradient(90deg, var(--atom-muted) 25%, #e8e8e8 50%, var(--atom-muted) 75%);
  background-size: 200% 100%;
  animation: atom-shimmer 1.5s infinite;
}

/* ============================================================
   SLIDER
   ============================================================ */
.atom-slider {
  appearance: none;
  -webkit-appearance: none;
  height: 0.25rem;
  width: 100%;
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-secondary);
  outline: none;
  cursor: pointer;
  accent-color: var(--atom-primary);
}
.atom-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-bg);
  border: 2px solid var(--atom-primary);
  cursor: pointer;
  box-shadow: var(--atom-shadow-sm);
  transition: transform var(--atom-transition);
}
.atom-slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
.atom-slider:focus-visible { outline: 2px solid var(--atom-ring); outline-offset: 4px; }
.atom-slider:disabled { opacity: 0.5; cursor: not-allowed; }
.atom-slider::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-bg);
  border: 2px solid var(--atom-primary);
  cursor: pointer;
  box-shadow: var(--atom-shadow-sm);
}

/* ============================================================
   SPINNER
   ============================================================ */
.atom-spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--atom-muted);
  border-top-color: var(--atom-primary);
  border-radius: var(--atom-radius-full);
  animation: atom-spin 0.75s linear infinite;
  vertical-align: middle;
  font-size: 0;
  color: transparent;
}
.atom-spinner-sm { width: 1rem;   height: 1rem;   border-width: 2px; }
.atom-spinner-lg { width: 2.5rem; height: 2.5rem; border-width: 3px; }

/* ============================================================
   STACK
   ============================================================ */
.atom-stack { font-family: var(--atom-font); }

/* ============================================================
   SWITCH (Toggle Switch)
   ============================================================ */
.atom-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-input-border);
  border: none;
  cursor: pointer;
  transition: background-color var(--atom-transition);
  flex-shrink: 0;
  outline: none;
}
.atom-switch:focus-visible {
  outline: 2px solid var(--atom-ring);
  outline-offset: 2px;
}
.atom-switch-checked { background-color: var(--atom-primary); }
.atom-switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.atom-switch-thumb {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-bg);
  box-shadow: var(--atom-shadow-sm);
  transition: transform var(--atom-transition);
  transform: translateX(0.1875rem);
  pointer-events: none;
}
.atom-switch-checked .atom-switch-thumb {
  transform: translateX(1.4375rem);
}

.atom-switch-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--atom-font);
  font-size: 0.875rem;
  cursor: pointer;
}
.atom-switch-label { color: var(--atom-fg); }

/* ============================================================
   TABLE
   ============================================================ */
.atom-table-wrapper {
  width: 100%;
  overflow: auto;
  font-family: var(--atom-font);
}
.atom-table {
  width: 100%;
  caption-side: bottom;
  border-collapse: collapse;
  font-size: 0.875rem;
  color: var(--atom-fg);
}
.atom-table-caption {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
  text-align: center;
}
.atom-table-header { }
.atom-table-body { }
.atom-table-footer {
  background-color: var(--atom-muted);
  font-weight: 500;
}
.atom-table-row {
  border-bottom: 1px solid var(--atom-border);
  transition: background-color var(--atom-transition);
}
.atom-table-header .atom-table-row { border-bottom: 1px solid var(--atom-border); }
.atom-table-body .atom-table-row:hover { background-color: var(--atom-muted); }
.atom-table-head {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 500;
  color: var(--atom-muted-fg);
  white-space: nowrap;
}
.atom-table-cell {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}
.atom-table-cell-right { text-align: right; }

/* ============================================================
   TABS
   ============================================================ */
.atom-tabs { font-family: var(--atom-font); }
.atom-tabs-list {
  display: inline-flex;
  align-items: center;
  background-color: var(--atom-muted);
  border-radius: var(--atom-radius-md);
  padding: 0.25rem;
  gap: 0.125rem;
}
.atom-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--atom-radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--atom-muted-fg);
  transition: all var(--atom-transition);
  white-space: nowrap;
  font-family: var(--atom-font);
  outline: none;
}
.atom-tab:hover:not(.atom-tab-active) { color: var(--atom-fg); }
.atom-tab-active {
  background-color: var(--atom-bg);
  color: var(--atom-fg);
  box-shadow: var(--atom-shadow-sm);
}
.atom-tab:focus-visible { outline: 2px solid var(--atom-ring); outline-offset: 2px; }
.atom-tabs-panel {
  margin-top: 0.5rem;
  outline: none;
}

/* ============================================================
   TEXTAREA
   ============================================================ */
.atom-textarea {
  display: flex;
  width: 100%;
  min-height: 5rem;
  border-radius: var(--atom-radius-md);
  border: 1px solid var(--atom-input-border);
  background-color: var(--atom-bg);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--atom-fg);
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--atom-transition), box-shadow var(--atom-transition);
  outline: none;
  font-family: var(--atom-font);
  min-width: 0;
}
.atom-textarea::placeholder { color: var(--atom-muted-fg); }
.atom-textarea:focus {
  border-color: var(--atom-ring);
  box-shadow: 0 0 0 3px rgb(24 24 27 / 0.1);
}
.atom-textarea:disabled { opacity: 0.5; cursor: not-allowed; resize: none; }
.atom-textarea-invalid { border-color: var(--atom-destructive); }
.atom-textarea-invalid:focus {
  border-color: var(--atom-destructive);
  box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15);
}

/* ============================================================
   TOAST
   ============================================================ */
.atom-toaster {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  font-family: var(--atom-font);
  max-width: 24rem;
  width: 100%;
}
.atom-toaster-bottom-right { bottom: 1.5rem; right: 1.5rem; align-items: flex-end; }
.atom-toaster-bottom-left  { bottom: 1.5rem; left:  1.5rem; align-items: flex-start; }
.atom-toaster-top-right    { top: 1.5rem;    right: 1.5rem; align-items: flex-end; }
.atom-toaster-top-left     { top: 1.5rem;    left:  1.5rem; align-items: flex-start; }
.atom-toaster-top-center   { top: 1.5rem;    left: 50%; transform: translateX(-50%); align-items: center; }
.atom-toaster-bottom-center{ bottom: 1.5rem; left: 50%; transform: translateX(-50%); align-items: center; }

.atom-toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: var(--atom-bg);
  border: 1px solid var(--atom-border);
  border-radius: var(--atom-radius-lg);
  padding: 0.875rem 1rem;
  box-shadow: var(--atom-shadow-lg);
  width: 100%;
  animation: atom-slide-in-right 0.2s ease;
}
.atom-toast-icon { flex-shrink: 0; width: 1.125rem; height: 1.125rem; margin-top: 0.0625rem; }
.atom-toast-body { flex: 1; min-width: 0; }
.atom-toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--atom-fg);
  margin: 0 0 0.125rem;
}
.atom-toast-description {
  font-size: 0.8125rem;
  color: var(--atom-muted-fg);
  line-height: 1.4;
  margin: 0;
}
.atom-toast-action {
  flex-shrink: 0;
  align-self: center;
}
.atom-toast-close {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--atom-radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--atom-muted-fg);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--atom-transition), color var(--atom-transition);
  align-self: flex-start;
}
.atom-toast-close:hover { background-color: var(--atom-accent); color: var(--atom-fg); }

.atom-toast-success     { border-left: 4px solid var(--atom-success); }
.atom-toast-destructive { border-left: 4px solid var(--atom-destructive); }
.atom-toast-warning     { border-left: 4px solid var(--atom-warning); }

/* ============================================================
   TOGGLE BUTTON
   ============================================================ */
.atom-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--atom-radius-md);
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--atom-muted-fg);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--atom-transition);
  outline: none;
  font-family: var(--atom-font);
}
.atom-toggle:focus-visible { outline: 2px solid var(--atom-ring); outline-offset: 2px; }
.atom-toggle:disabled { pointer-events: none; opacity: 0.5; }

.atom-toggle-sm      { height: 2rem;    padding: 0 0.625rem; }
.atom-toggle-default { height: 2.25rem; padding: 0 0.75rem; }
.atom-toggle-lg      { height: 2.5rem;  padding: 0 1rem; }

.atom-toggle-default-variant:hover:not(:disabled) { background-color: var(--atom-muted); color: var(--atom-fg); }
.atom-toggle-outline-variant { border-color: var(--atom-border); }
.atom-toggle-outline-variant:hover:not(:disabled) { background-color: var(--atom-accent); color: var(--atom-fg); }

.atom-toggle-pressed { background-color: var(--atom-accent); color: var(--atom-accent-fg); }
.atom-toggle-pressed.atom-toggle-outline-variant { background-color: var(--atom-accent); border-color: var(--atom-accent); }

/* ============================================================
   TOOLTIP
   ============================================================ */
.atom-tooltip-wrapper {
  position: relative;
  display: inline-flex;
}
.atom-tooltip-content {
  position: absolute;
  z-index: 50;
  background-color: var(--atom-primary);
  color: var(--atom-primary-fg);
  border-radius: var(--atom-radius-md);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--atom-shadow-md);
  animation: atom-fade-in-scale 0.1s ease;
  font-family: var(--atom-font);
}
/* Placement variants */
.atom-tooltip-top    { bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
.atom-tooltip-bottom { top: calc(100% + 6px);    left: 50%; transform: translateX(-50%); }
.atom-tooltip-left   { right: calc(100% + 6px);  top: 50%;  transform: translateY(-50%); }
.atom-tooltip-right  { left:  calc(100% + 6px);  top: 50%;  transform: translateY(-50%); }

/* Arrow */
.atom-tooltip-content::before {
  content: "";
  position: absolute;
  border: 4px solid transparent;
}
.atom-tooltip-top::before    { top: 100%;    left: 50%; transform: translateX(-50%); border-top-color: var(--atom-primary); }
.atom-tooltip-bottom::before { bottom: 100%; left: 50%; transform: translateX(-50%); border-bottom-color: var(--atom-primary); }
.atom-tooltip-left::before   { left: 100%;   top: 50%;  transform: translateY(-50%); border-left-color: var(--atom-primary); }
.atom-tooltip-right::before  { right: 100%;  top: 50%;  transform: translateY(-50%); border-right-color: var(--atom-primary); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.atom-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  font-family: var(--atom-font);
}
.atom-empty-icon {
  margin-bottom: 1rem;
  color: var(--atom-muted-fg);
}
.atom-empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--atom-fg);
  margin: 0 0 0.5rem;
}
.atom-empty-text {
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
  line-height: 1.5;
  margin: 0 0 1.5rem;
  max-width: 28rem;
}
.atom-empty-action { margin-top: 0.5rem; }

/* ============================================================
   SEGMENTED BUTTON
   ============================================================ */
.atom-segmented {
  display: inline-flex;
  align-items: center;
  background-color: transparent;
  border-radius: var(--atom-radius-md);
  padding: 0;
  gap: 0.25rem;
  font-family: var(--atom-font);
}

.atom-segmented-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border: none;
  background-color: var(--atom-muted);
  border-radius: var(--atom-radius-md);
  color: var(--atom-muted-fg);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--atom-transition), color var(--atom-transition);
  outline: none;
  font-family: var(--atom-font);
  user-select: none;
  -webkit-user-select: none;
}

.atom-segmented-btn:hover:not(:disabled):not(.atom-segmented-btn-active) {
  background-color: var(--atom-border);
  color: var(--atom-fg);
}

.atom-segmented-btn-active {
  background-color: var(--atom-border);
  color: var(--atom-fg);
}

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

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

/* Sizes */
.atom-segmented-sm .atom-segmented-btn  { height: 1.75rem; padding: 0 0.625rem; font-size: 0.8125rem; }
.atom-segmented-default .atom-segmented-btn { height: 2rem;    padding: 0 0.75rem; }
.atom-segmented-lg .atom-segmented-btn  { height: 2.25rem; padding: 0 1rem;    font-size: 1rem; }

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes atom-spin {
  to { transform: rotate(360deg); }
}

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

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

/* ============================================================
   MULTI-SELECT
   ============================================================ */
.atom-multiselect {
  position: relative;
  width: 100%;
  min-height: 2.25rem;
  border-radius: var(--atom-radius-md);
  border: 1px solid var(--atom-input-border);
  background-color: var(--atom-bg);
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  color: var(--atom-fg);
  cursor: text;
  transition: border-color var(--atom-transition), box-shadow var(--atom-transition);
  font-family: var(--atom-font);
}
.atom-multiselect-open {
  border-color: var(--atom-ring);
  box-shadow: 0 0 0 3px rgb(24 24 27 / 0.1);
}
.atom-multiselect-invalid {
  border-color: var(--atom-destructive);
}
.atom-multiselect-invalid.atom-multiselect-open {
  box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15);
}
.atom-multiselect-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.atom-multiselect-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.atom-multiselect-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem 0.125rem 0.625rem;
  border-radius: var(--atom-radius-full);
  background-color: var(--atom-secondary);
  color: var(--atom-secondary-fg);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
.atom-multiselect-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border: none;
  background: transparent;
  color: var(--atom-muted-fg);
  font-size: 1rem;
  line-height: 1;
  border-radius: var(--atom-radius-full);
  cursor: pointer;
  padding: 0;
  transition: background-color var(--atom-transition), color var(--atom-transition);
}
.atom-multiselect-chip-remove:hover {
  background-color: var(--atom-destructive);
  color: var(--atom-destructive-fg);
}

.atom-multiselect-input {
  flex: 1 1 4rem;
  min-width: 4rem;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.875rem;
  color: var(--atom-fg);
  font-family: var(--atom-font);
  padding: 0.125rem 0;
  height: 1.75rem;
}
.atom-multiselect-input::placeholder { color: var(--atom-muted-fg); }
.atom-multiselect-input:disabled { cursor: not-allowed; }

.atom-multiselect-dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 50;
  background-color: var(--atom-popover-bg);
  border: 1px solid var(--atom-border);
  border-radius: var(--atom-radius-md);
  box-shadow: var(--atom-shadow-md);
  max-height: 14rem;
  overflow-y: auto;
  animation: atom-fade-in-scale 0.1s ease;
}
.atom-multiselect-option {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--atom-fg);
  transition: background-color var(--atom-transition);
}
.atom-multiselect-option:hover {
  background-color: var(--atom-accent);
  color: var(--atom-accent-fg);
}
.atom-multiselect-empty {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
  text-align: center;
}

/* ============================================================
   COMBOBOX (Relational Lookup / Autocomplete)
   ============================================================ */
.atom-combobox {
  position: relative;
  width: 100%;
  font-family: var(--atom-font);
  font-size: 0.875rem;
}
.atom-combobox-trigger {
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  border-radius: var(--atom-radius-md);
  border: 1px solid var(--atom-input-border);
  background-color: var(--atom-bg);
  padding: 0 0.5rem 0 0.75rem;
  gap: 0.25rem;
  cursor: pointer;
  transition: border-color var(--atom-transition), box-shadow var(--atom-transition);
}
.atom-combobox-open .atom-combobox-trigger {
  border-color: var(--atom-ring);
  box-shadow: 0 0 0 3px rgb(24 24 27 / 0.1);
}
.atom-combobox-invalid .atom-combobox-trigger {
  border-color: var(--atom-destructive);
}
.atom-combobox-invalid.atom-combobox-open .atom-combobox-trigger {
  box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15);
}
.atom-combobox-disabled .atom-combobox-trigger {
  opacity: 0.5;
  cursor: not-allowed;
}

.atom-combobox-input {
  flex: 1 1 0;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.875rem;
  color: var(--atom-fg);
  font-family: var(--atom-font);
  padding: 0;
  height: 2rem;
  cursor: text;
}
.atom-combobox-input::placeholder { color: var(--atom-muted-fg); }

.atom-combobox-value {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--atom-fg);
  line-height: 2rem;
}

.atom-combobox-clear {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border: none;
  background: transparent;
  color: var(--atom-muted-fg);
  font-size: 1rem;
  line-height: 1;
  border-radius: var(--atom-radius-full);
  cursor: pointer;
  padding: 0;
  transition: background-color var(--atom-transition), color var(--atom-transition);
}
.atom-combobox-clear:hover {
  background-color: var(--atom-destructive);
  color: var(--atom-destructive-fg);
}

.atom-combobox-chevron {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--atom-muted-fg);
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.atom-combobox-dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 50;
  background-color: var(--atom-popover-bg);
  border: 1px solid var(--atom-border);
  border-radius: var(--atom-radius-md);
  box-shadow: var(--atom-shadow-md);
  max-height: 14rem;
  overflow-y: auto;
  animation: atom-fade-in-scale 0.1s ease;
}
.atom-combobox-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--atom-fg);
  transition: background-color var(--atom-transition);
}
.atom-combobox-option:hover,
.atom-combobox-option-active {
  background-color: var(--atom-accent);
  color: var(--atom-accent-fg);
}
.atom-combobox-option-selected {
  font-weight: 500;
}
.atom-combobox-option-check {
  font-size: 0.8125rem;
  color: var(--atom-primary);
  flex-shrink: 0;
}
.atom-combobox-empty {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--atom-muted-fg);
  text-align: center;
}

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

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

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

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

@keyframes atom-slide-in-top {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes atom-slide-in-bottom {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes atom-slide-out-left {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-100%); }
}

@keyframes atom-slide-out-top {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-100%); }
}

@keyframes atom-slide-out-bottom {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(100%); }
}
