@layer core {
  /*=========================
     Table of Contents
  =========================*/
  /*
     1    Alpine
     7    Button
     52   Button Variants
     86   Button Hover
     105  Button Feedback
     136  Button Sizes
     152  Icon Button
     169  Icon
     186  Icon Sizes
     195  Premium Banner
     253  Form
     269  Label
     278  Fields
     308  Focus
     318  Textarea
     326  Select
     346  Password
     378  Checkbox / Radio
     436  File Input
     473  Errors
     510  Filter / Toolbar
     521  Search
     531  Selects
     541  Actions
     549  Responsive
     565  Badge
     582  Badge Soft
     620  Avatar
     636  Tag
     651  Avatar Sizes
     664  Avatar Variants
     671  Theme
     680  Identifier
     697  Title Icon
     712  Title Icon Variants
     743  Empty Icon
     759  Brand Logo
  */

  /*=========================
   Alpine
=========================*/
  [x-cloak] {
    display: none !important;
  }
  /*=========================
   Button
=========================*/
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 2.375rem;
    padding: 0 var(--space-4);
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-button);
    background: transparent;
    color: inherit;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition:
      background var(--motion-hover),
      color var(--motion-hover),
      border-color var(--motion-hover),
      box-shadow var(--motion-hover),
      transform var(--motion-hover);
  }
  .btn:hover {
    transform: translateY(-1px);
  }
  .btn:active {
    transform: translateY(0);
  }
  .btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
  }
  .btn:disabled,
  .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }
  /*=========================
   Button Variants
=========================*/
  .btn-primary {
    background: var(--action-primary);
    color: var(--white);
    box-shadow: var(--shadow-sm);
  }
  .btn-gradient {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: var(--shadow-sm);
  }
  .btn-secondary {
    background: var(--action-secondary);
    color: var(--white);
  }
  .btn-accent {
    background: var(--action-accent);
    color: var(--white);
  }
  .btn-surface {
    background: color-mix(in srgb, var(--surface), var(--foreground) 5%);
    color: var(--text);
    border-color: var(--border-color);
    box-shadow: var(--shadow-xs);
  }
  .btn-outline {
    color: var(--primary);
    border: 1px solid var(--primary) !important;
  }
  .btn-outline-danger {
    color: var(--danger);
    border: 1px solid var(--danger) !important;
  }
  .btn-ghost {
    background: transparent;
    color: var(--text);
  }
  /*=========================
   Button Hover
=========================*/
  .btn-primary:hover {
    background: rgb(var(--action-primary-rgb) / 0.9);
  }
  .btn-gradient:hover {
    opacity: 0.9;
  }
  .btn-secondary:hover {
    background: rgb(var(--action-secondary-rgb) / 0.9);
  }
  .btn-accent:hover {
    background: rgb(var(--action-accent-rgb) / 0.9);
  }
  .btn-outline:hover {
    background: var(--primary-10);
  }
  .btn-surface:hover,
  .btn-ghost:hover {
    background: var(--surface-hover);
  }
  /*=========================
   Button Feedback
=========================*/
  .btn-success {
    background: var(--success-100);
    color: var(--white);
  }
  .btn-warning {
    background: var(--warning-100);
    color: var(--dark);
  }
  .btn-danger {
    background: var(--danger-100);
    color: var(--white);
  }
  .btn-success:hover {
    background: rgb(var(--success-rgb) / 0.9);
  }
  .btn-warning:hover {
    background: rgb(var(--warning-rgb) / 0.9);
  }
  .btn-danger:hover {
    background: rgb(var(--danger-rgb) / 0.9);
  }
  .btn-info {
    background: var(--info-100);
    color: var(--white);
  }
  .btn-info:hover {
    background: rgb(var(--info-rgb) / 0.9);
  }
  /*=========================
   Button Sizes
=========================*/
  .btn-sm {
    height: 2rem;
    padding: 0 var(--space-3);
    font-size: var(--text-xs);
  }
  .btn-lg {
    height: 2.75rem;
    padding: 0 var(--space-6);
    font-size: var(--text-base);
  }
  .btn-full {
    width: 100%;
  }
  /*=========================
   Icon Button
=========================*/
  .btn-icon {
    width: 2.375rem;
    height: 2.375rem;
    padding: 0;
    flex-shrink: 0;
  }
  .btn-icon.btn-sm {
    width: 2rem;
    height: 2rem;
  }
  .btn-icon.btn-lg {
    width: 2.75rem;
    height: 2.75rem;
  }
  /*=========================
   Icon
=========================*/
  .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: "Material Symbols Rounded";
    font-size: var(--text-xl);
    line-height: var(--leading-none);
    font-variation-settings:
      "FILL" 0,
      "wght" 400,
      "GRAD" 0,
      "opsz" 24;
  }
  /*=========================
   Icon Sizes
=========================*/
  .icon-sm {
    font-size: var(--text-sm);
  }
  .icon-lg {
    font-size: var(--text-lg);
  }
  /*=========================
   Premium Banner
=========================*/
  .premium-banner {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 3rem;
    padding: 0 var(--space-4);
    border-radius: var(--radius-xl);
    background: var(--tertiary-gradient-soft);
    border: 1px solid var(--tertiary-20);
    color: var(--text);
    text-decoration: none;
    transition:
      background var(--motion-hover),
      border-color var(--motion-hover);
  }
  .premium-banner:hover {
    background: var(--tertiary-20);
    border-color: var(--tertiary-40);
  }
  .premium-banner-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    background: var(--tertiary-100);
    color: var(--white);
    font-size: var(--text-lg);
    font-variation-settings:
      "FILL" 1,
      "wght" 600,
      "GRAD" 0,
      "opsz" 24;
  }
  .premium-banner-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .premium-banner-content strong {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    line-height: 1;
  }
  .premium-banner-content small {
    color: var(--text-muted);
    font-size: var(--text-xs);
    line-height: 1;
  }
  /* Active subscription */
  .premium-banner.active {
    background: var(--success-10);
    border-color: var(--success-50);
  }
  .premium-banner.active .premium-banner-icon {
    background: var(--success-100);
  }
  /*=========================
   Form
=========================*/
  .form,
  form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
  }
  .form-field,
  form p {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
  }
  /*=========================
   Label
=========================*/
  label {
    display: inline-block;
    margin-bottom: var(--space-2);
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: var(--leading-none);
  }
  /*=========================
   Fields
=========================*/
  input:not([type="checkbox"]):not([type="radio"]),
  textarea,
  select {
    width: 100%;
    min-height: 3.5rem;
    padding-inline: var(--space-5);
    background: var(--surface);
    color: var(--text);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-input);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    transition:
      background var(--motion-hover),
      border-color var(--motion-hover),
      box-shadow var(--motion-hover);
  }
  input::placeholder,
  textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.65;
  }
  input:not([type="checkbox"]):not([type="radio"]):hover,
  textarea:hover,
  select:hover {
    border-color: rgb(var(--primary-rgb) / 0.25);
  }
  /*=========================
   Focus
=========================*/
  input:focus,
  textarea:focus,
  select:focus {
    outline: none;
    border-color: var(--action-primary);
    box-shadow: var(--focus-ring);
  }
  /*=========================
   Textarea
=========================*/
  textarea {
    min-height: 8rem;
    padding-block: var(--space-4);
    resize: vertical;
  }
  /*=========================
   Select
=========================*/
  select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 3rem;
    cursor: pointer;
    background-image:
      linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
      calc(100% - 1.25rem) 50%,
      calc(100% - 0.9rem) 50%;
    background-size:
      0.35rem 0.35rem,
      0.35rem 0.35rem;
    background-repeat: no-repeat;
  }
  /*=========================
   Password
=========================*/
  .password-wrapper {
    position: relative;
  }
  .password-wrapper input {
    padding-right: 3rem;
  }
  .password-toggle {
    position: absolute;
    top: 50%;
    right: var(--space-3);
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition:
      background var(--motion-hover),
      color var(--motion-hover);
  }
  .password-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
  }
  /*=========================
   Checkbox / Radio
=========================*/
  .form-group:has(input[type="checkbox"]),
  .form-group:has(input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }
  input[type="checkbox"],
  input[type="radio"] {
    appearance: none;
    display: inline-grid;
    place-content: center;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    border: var(--border-width-lg) solid var(--border-color);
    background: var(--surface);
    color: var(--white);
    cursor: pointer;
    transition:
      background var(--motion-hover),
      border-color var(--motion-hover);
  }
  input[type="checkbox"] {
    border-radius: var(--radius-sm);
  }
  input[type="radio"] {
    border-radius: var(--radius-full);
  }
  input[type="checkbox"]::before,
  input[type="radio"]::before {
    content: "";
    transform: scale(0);
    transition: transform var(--motion-hover);
  }
  input[type="checkbox"]::before {
    width: 0.65rem;
    height: 0.65rem;
    background: currentColor;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  }
  input[type="radio"]::before {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: var(--radius-full);
    background: currentColor;
  }
  input[type="checkbox"]:checked,
  input[type="radio"]:checked {
    background: var(--action-primary);
    border-color: var(--action-primary);
  }
  input[type="checkbox"]:checked::before,
  input[type="radio"]:checked::before {
    transform: scale(1);
  }
  /*=========================
   File Input
=========================*/
  input[type="file"] {
    width: 100%;
    min-height: 3.5rem;
    padding: var(--space-2);
    background: var(--surface);
    color: var(--text-muted);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-input);
    font-size: var(--text-sm);
    cursor: pointer;
    transition:
      background var(--motion-hover),
      border-color var(--motion-hover);
  }
  input[type="file"]:hover {
    background: rgb(var(--surface-hover-rgb) / 0.35);
  }
  input[type="file"]::file-selector-button {
    height: 2.5rem;
    margin-right: var(--space-4);
    padding: 0 var(--space-5);
    border: none;
    border-radius: var(--radius-button);
    background: var(--action-primary);
    color: var(--white);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: background var(--motion-hover);
  }
  input[type="file"]::file-selector-button:hover {
    background: rgb(var(--action-primary-rgb) / 0.9);
  }
  /*=========================
   Errors
=========================*/
  .errorlist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: var(--space-3) 0;
    padding: 0;
  }
  .errorlist li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--danger-10);
    color: var(--danger-100);
    border: var(--border-width) solid var(--danger-50);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
  }
  .errorlist li::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    background: var(--danger-100);
    color: var(--white);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
  }
  /*=========================
   Filter / Toolbar
=========================*/
  .card.filter {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3);
  }
  /*=========================
   Search
=========================*/
  .filter-search {
    flex: 1 1 auto;
    min-width: 0;
  }
  .filter-search input {
    width: 100%;
  }
  /*=========================
   Selects
=========================*/
  .filter-select {
    flex: 0 0 180px;
    min-width: 0;
  }
  .filter-select select {
    width: 100%;
  }
  /*=========================
   Actions
=========================*/
  .filter .btn,
  .filter button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  /*=========================
   Responsive
=========================*/
  @media (max-width: 768px) {
    .card.filter {
      flex-direction: column;
      align-items: stretch;
    }
    .filter-search,
    .filter-select,
    .filter .btn,
    .filter button {
      width: 100%;
      flex: none;
    }
  }
  /*=========================
   Badge
=========================*/
  .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: var(--leading-none);
    white-space: nowrap;
    user-select: none;
  }
  /*=========================
   Badge Soft
=========================*/
  .badge-primary {
    background: var(--primary-10);
    color: var(--primary-100);
    border-color: var(--primary-20);
  }
  .badge-secondary {
    background: var(--secondary-10);
    color: var(--secondary-100);
    border-color: var(--secondary-20);
  }
  .badge-tertiary {
    background: var(--tertiary-10);
    color: var(--tertiary-100);
    border-color: var(--tertiary-20);
  }
  .badge-success {
    background: var(--success-10);
    color: var(--success-100);
    border-color: var(--success-50);
  }
  .badge-info {
    background: var(--info-10);
    color: var(--info-100);
    border-color: var(--info-50);
  }
  .badge-warning {
    background: var(--warning-10);
    color: var(--warning-100);
    border-color: var(--warning-50);
  }
  .badge-danger {
    background: var(--danger-10);
    color: var(--danger-100);
    border-color: var(--danger-50);
  }
  /*=========================
   Avatar
=========================*/
  .avatar {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-avatar);
    background: var(--accent-10);
    color: var(--accent-100);
    font-weight: var(--font-bold);
    user-select: none;
  }
  /*=========================
   Tag
=========================*/
  .tag {
    width: fit-content;
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
  }
  .tag-primary {
    background: var(--primary-10);
    color: var(--primary-100);
  }
  /*=========================
   Avatar Sizes
=========================*/
  .avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: var(--text-sm);
  }
  .avatar-lg {
    width: 4rem;
    height: 4rem;
    font-size: var(--text-xl);
  }
  /*=========================
   Avatar Variants
=========================*/
  .avatar-primary {
    background: var(--primary-10);
    color: var(--primary-100);
  }
  /*=========================
   Theme
=========================*/
  .theme-toggle-floating {
    position: fixed;
    right: var(--space-5);
    bottom: var(--space-5);
    z-index: var(--z-sticky);
  }
  /*=========================
   Identifier
=========================*/
  .identifier {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: var(--space-1) var(--space-2);
    border: var(--border-width) solid var(--info-50);
    border-radius: var(--radius-sm);
    background: var(--info-10);
    color: var(--info-100);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: var(--leading-none);
  }
  /*=========================
   Title Icon
=========================*/
  .title-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-xl);
  }
  .title-icon .icon {
    font-size: var(--text-2xl);
  }
  /*=========================
   Title Icon Variants
=========================*/
  .title-icon-primary {
    background: var(--primary-10);
    color: var(--primary-100);
  }
  .title-icon-secondary {
    background: var(--secondary-10);
    color: var(--secondary-100);
  }
  .title-icon-accent {
    background: var(--accent-10);
    color: var(--accent-100);
  }
  .title-icon-success {
    background: var(--success-10);
    color: var(--success-100);
  }
  .title-icon-info {
    background: var(--info-10);
    color: var(--info-100);
  }
  .title-icon-warning {
    background: var(--warning-10);
    color: var(--warning-100);
  }
  .title-icon-danger {
    background: var(--danger-10);
    color: var(--danger-100);
  }
  /*=========================
   Empty Icon
=========================*/
  .empty-icon {
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--primary-10);
    color: var(--primary-100);
  }
  .empty-icon .icon {
    font-size: var(--text-3xl);
  }
  /*=========================
   Brand Logo
=========================*/
  .menu-logo {
    display: inline-flex;
  }
  .menu-logo img {
    width: 100px;
    height: auto;
  }
}
