/* ─── Font faces ────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Cabify Ciudad';
  font-weight: 400;
  font-style: normal;
  src: url('./fonts/CabifyCiudad-Book.woff2') format('woff2'),
       url('./fonts/CabifyCiudad-Book.woff') format('woff');
}

@font-face {
  font-family: 'Cabify Ciudad';
  font-weight: 700;
  font-style: normal;
  src: url('./fonts/CabifyCiudad-Bold.woff2') format('woff2'),
       url('./fonts/CabifyCiudad-Bold.woff') format('woff');
}

@font-face {
  font-family: 'Cabify Ciudad Text';
  font-weight: 400;
  font-style: normal;
  src: url('./fonts/CabifyCiudadText-Book.woff2') format('woff2'),
       url('./fonts/CabifyCiudadText-Book.woff') format('woff');
}

@font-face {
  font-family: 'Cabify Ciudad Text';
  font-weight: 700;
  font-style: normal;
  src: url('./fonts/CabifyCiudadText-Bold.woff2') format('woff2'),
       url('./fonts/CabifyCiudadText-Bold.woff') format('woff');
}

/* ─── Design tokens ─────────────────────────────────────────────────────────── */

:root {
  /* Colors */
  --color-background-surface-base:           #ffffff;
  --color-background-surface-subdued:        #f8f8fe;
  --color-background-surface-contrast:       #1F123F;
  --color-background-element-default:        #ffffff;
  --color-background-element-default-hover:  #f5f1fc;
  --color-background-element-default-pressed:#dfd9f8;
  --color-background-element-accentsubtle:   #f5f1fc;
  --color-background-element-neutralsubtle:         #f3f3f7;
  --color-background-element-neutralsubtle-pressed: #ffffff;
  --color-background-semantic-infosubtle: #ECF4FD;
  
  --color-border:               #dbdce8;
  --color-border-accent:        #7145d6;
  --color-border-accent-hover:  #5a35b2;
  --color-border-accent-pressed:#4a2b8d;

  --color-foreground-content-primary:       #1a1a1c;
  --color-foreground-content-secondary:     #5e6088;
  --color-foreground-action-neutral:        #5e6088;
  --color-foreground-action-accent:         #7145d6;
  --color-foreground-action-accent-hover:   #5a35b2;
  --color-foreground-action-accent-pressed: #4a2b8d;
  --color-foreground-semantic-info: #2760C2;
  --color-foreground-content-primary-on-contrast: #FFFFFF;


  --color-text-disabled:   #9a9ab0;
  --color-bg-primary-hover:#ede8f8;
  --color-preview-bg:      #f8f8fe;

  /* Typography */
  --font-family:           'Cabify Ciudad Text', system-ui, -apple-system, sans-serif;
  --font-family-display:   'Cabify Ciudad', system-ui, -apple-system, sans-serif;
  --font-weight-regular:   400;
  --font-weight-bold:      700;
  --font-size-body-lead:        16px;
  --font-size-body:             14px;
  --font-size-caption:          13px;
  --font-size-overline:         11px;
  --font-line-height-lg:  24px;
  --font-line-height-md:  20px;
  --font-line-height-sm:  16px;
  --font-text-case-uppercase: uppercase;

  --text-utility-ui-label-md:   var(--font-weight-regular) var(--font-size-body) / var(--font-line-height-md) var(--font-family);
  --text-utility-ui-label-sm:   var(--font-weight-regular) var(--font-size-caption) / var(--font-line-height-sm) var(--font-family);
  --text-utility-component-badge:   var(--font-weight-bold) var(--font-size-overline) / var(--font-line-height-sm) var(--font-family-display);

  --text-composition-title-heading-md:   var(--font-weight-bold) var(--font-size-body) / var(--font-line-height-md) var(--font-family-display);
  --text-composition-title-heading-lg:   var(--font-weight-bold) var(--font-size-body-lead) / var(--font-line-height-lg) var(--font-family-display);
  --text-composition-title-overline:   var(--font-weight-bold) var(--font-size-overline) / var(--font-line-height-sm) var(--font-family-display);
  --text-composition-content-body-lg:   var(--font-weight-regular) var(--font-size-body-lead) / var(--font-line-height-md) var(--font-family);
  --text-composition-content-body-md:   var(--font-weight-regular) var(--font-size-body) / var(--font-line-height-md) var(--font-family);
  --text-composition-content-caption:   var(--font-weight-regular) var(--font-size-caption) / var(--font-line-height-sm) var(--font-family);


  /* Spacing */
  --sidebar-width:         240px;
  --page-max-width:        1440px;

  /* Radii */
  --radius-xs:             4px;
  --radius-sm:             8px;
  --radius-md:             12px;
  --radius-lg:             16px;
}

/* ─── Reset & base ──────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-weight: var(--font-weight-regular);
  color: var(--color-foreground-content-primary);
  background: var(--color-background-surface-base);
  min-height: 100vh;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */

.app {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  margin: 0 auto;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-background-surface-subdued);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  height: 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  padding: 24px 16px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  color: var(--color-foreground-action-accent);
}

.sidebar-logo img,
.sidebar-logo svg {
  height: 20px;
  width: auto;
}

.logo-mark { display: none; }
.logo-full  { display: block; }

.sidebar-logo-text {
  font-size: 18px;
  font-weight: var(--font-weight-bold);
  color: var(--color-foreground-action-accent);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Sidemenu action */
.sidemenu-action {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 16px 0 2px;
  cursor: pointer;
  border-radius: 0;
  color: var(--color-foreground-content-primary);
  font: var(--text-utility-ui-label-md);
  transition: background 0.12s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.sidemenu-action:hover {
  background: var(--color-background-element-neutralsubtle);
}

.sidemenu-action.is-active {
  background: var(--color-background-element-default-hover);
  color: var(--color-foreground-action-accent);
  font-weight: var(--font-weight-bold);
}

.sidemenu-action .line-active {
  display: block;
  height: 24px;
  width: 2px;
  margin-right: 4px;
  background: transparent;
  border-radius: var(--radius-md);
}
.sidemenu-action.is-active .line-active {
  background: var(--color-foreground-action-accent);
}

.sidemenu-action .action-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: inherit;
  color: var(--color-foreground-action-neutral)
}

.sidemenu-action .action-icon img,
.sidemenu-action .action-icon svg {
  width: 16px;
  height: 16px;
}

.sidemenu-action .action-label {
  white-space: nowrap;
}

.sidemenu-action.is-active .action-icon {
  color: var(--color-foreground-action-accent);
}

/* Sidebar secondary actions (footer) */
.sidebar-secondary {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-secondary .sidemenu-action {
  padding: 0px 16px;
}

.sidebar-footer-author {
  padding: 24px 16px;
  margin-top: 24px;
  font: var(--text-utility-ui-label-sm);
  color: var(--color-foreground-content-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: solid 1px var(--color-border);
}

.sidebar-footer-author svg {
  color: var(--color-foreground-action-accent);
  width: 16px;
  height: 16px;
}

/* ─── Main page area ────────────────────────────────────────────────────────── */

.page {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-content: center;
  flex-wrap: wrap;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */

.page-header {
  padding: 32px 24px 24px;
  max-width: var(--page-max-width);
  width: 100%;
}

.page-header-overline {
  font: var(--text-composition-title-overline);
  color: var(--color-foreground-content-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.page-header-title {
  font-size: 26px;
  font-weight: var(--font-weight-bold);
  color: var(--color-foreground-content-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* ─── Toolbar (search) ──────────────────────────────────────────────────────── */

.toolbar {
  padding: 0px 24px 16px 24px;
  max-width: var(--page-max-width);
  width: 100%;
  display: flex;
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
  gap: 12px;
}

.search-field {
  position: relative;
  width: 320px;
  flex-shrink: 0;
}

.search-field-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-foreground-action-neutral);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-field-icon img,
.search-field-icon svg {
  width: 16px;
  height: 16px;
}

.search-field input {
  width: 100%;
  height: 40px;
  background: var(--color-background-element-neutralsubtle);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 12px 0 34px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: var(--font-weight-regular);
  color: var(--color-foreground-content-primary);
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.search-field input::placeholder {
  color: var(--color-foreground-action-neutral);
}

.search-field input:hover {
  border-color: var(--color-border-accent-hover);
  background: var(--color-background-element-neutralsubtle);
}

.search-field input:focus {
  border-color: var(--color-border-accent);
  background: var(--color-background-element-neutralsubtle-pressed);
}

.search-field:hover .search-field-icon{
  color: var(--color-foreground-action-accent-hover);
}

.search-field:focus .search-field-icon{
  color: var(--color-foreground-action-accent);
}

.search-field:active .search-field-icon{
  color: var(--color-foreground-action-accent);
}

/* Search clear button */
.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-foreground-action-neutral);
  border-radius: var(--radius-xs);
  transition: color 0.12s ease;
}

.search-clear-btn:hover {
  color: var(--color-foreground-action-accent-hover);
}

.search-clear-btn svg {
  width: 16px;
  height: 16px;
}

/* Prevent clear button from overlapping text */
.search-field input::-webkit-search-cancel-button { display: none; }

/* ─── Filter component ─────────────────────────────────────────────────────── */

.filter-btn {
  position: relative;
}

/* Trigger wrapper (div) — provides the pill appearance */
.filter-trigger {
  display: flex;
  align-items: center;
  height: 40px;
  background: var(--color-background-element-neutralsubtle);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
  user-select: none;
  overflow: hidden;
}

.filter-trigger:hover {
  background: var(--color-background-element-default-hover);
  border-color: var(--color-border-accent-hover);
}

.filter-trigger.is-open {
  background: var(--color-background-element-default-pressed);
  border-color: var(--color-border-accent-pressed);
}

.filter-trigger.is-active {
  background: var(--color-background-element-default-hover);
  border-color: var(--color-border-accent);
}

.filter-trigger.is-active:hover {
  border-color: var(--color-border-accent-hover);
}

/* Inner main button (no own styling — inherits from wrapper) */
.filter-trigger-main {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 8px 0 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.filter-descriptor {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-by {
  font: var(--text-utility-ui-label-md);
  color: var(--color-foreground-content-secondary);
}

.filter-label {
  font: var(--text-utility-ui-label-md);
  color: var(--color-foreground-content-secondary);
}

.filter-trigger.is-active .filter-label {
  color: var(--color-foreground-action-neutral);
}

.filter-value-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-value-text {
  font: var(--text-utility-ui-label-md);
  color: var(--color-foreground-action-accent);
}

.filter-trailing {
  display: none; /* replaced by filter-trigger-main + filter-clear-btn siblings */
}

.filter-chevron {
  display: flex;
  align-items: center;
  width: 16px;
  height: 16px;
  color: var(--color-foreground-action-neutral);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.filter-chevron.is-open {
  transform: rotate(180deg);
}

.filter-chevron svg {
  width: 16px;
  height: 16px;
}

.filter-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 100%;
  flex-shrink: 0;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-foreground-action-accent);
  transition: color 0.12s ease, background 0.12s ease;
}

.filter-clear-btn:hover {
  color: var(--color-foreground-action-accent-hover);
}

.filter-clear-btn svg {
  width: 16px;
  height: 16px;
}

/* Mobile icon-only filter view — hidden at desktop, shown at ≤600px */
.filter-mobile-icon {
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.filter-mobile-icon svg {
  width: 16px;
  height: 16px;
}

/* Count badge on mobile filter icon */
.filter-mobile-icon[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -16px;
  right: -16px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--color-foreground-action-accent);
  color: var(--color-background-surface-base);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  line-height: 16px;
  text-align: center;
  border-radius: 16px;
  pointer-events: none;
}


/* Dropdown panel */
.filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  z-index: 200;
  background: var(--color-background-surface-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* Option items */
.filter-options {
  padding: 4px 0;
  max-height: 280px;
  overflow-y: auto;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}

.filter-option:hover {
  background: var(--color-background-element-default-hover);
}

.filter-option.is-checked {
  background: var(--color-background-element-accentsubtle);
}

.filter-option.is-checked:hover {
  background: var(--color-background-element-default-pressed);
}

.filter-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-background-element-default);
  transition: background 0.1s ease, border-color 0.1s ease;
  color: transparent;
}

.filter-option.is-checked .filter-checkbox {
  background: var(--color-foreground-action-accent);
  border-color: var(--color-foreground-action-accent);
  color: var(--color-background-surface-base);
}

.filter-option:hover .filter-checkbox {
  border-color: var(--color-border-accent-hover);
}

.filter-option.is-checked:hover .filter-checkbox {
  background: var(--color-foreground-action-accent-hover);
  border-color: var(--color-foreground-action-accent-hover);
}

.filter-checkbox svg {
  width: 12px;
  height: 12px;
}

.filter-option-label {
  font: var(--text-utility-ui-label-md);
  color: var(--color-foreground-content-secondary);
}

.filter-option.is-checked .filter-option-label {
  color: var(--color-foreground-action-accent);
}

/* Actions footer */
.filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  border-top: 1px solid var(--color-border);
  gap: 8px;
}

.filter-action-clear,
.filter-action-apply {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font: var(--text-utility-ui-label-md);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
  border: 1px solid transparent;
}

.filter-action-clear {
  background: var(--color-background-element-default);
  color: var(--color-foreground-action-accent);
}

.filter-action-clear:hover {
  color: var(--color-foreground-action-accent-hover);
  background: var(--color-background-element-default-hover);
}

.filter-action-apply {
  background: var(--color-foreground-action-accent);
  color: var(--color-background-surface-base);
  border-color: var(--color-foreground-action-accent);
}

.filter-action-apply:hover {
  background: var(--color-foreground-action-accent-hover);
  border-color: var(--color-foreground-action-accent-hover);
}

/* ─── Tab navigation ────────────────────────────────────────────────────────── */

.tab-nav {
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  max-width: var(--page-max-width);
  width: 100%;
}

.tab-nav-divider {
  height: 1px;
  background: var(--color-border);
  margin-bottom: 0;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 2px;
  font: var(--text-utility-ui-label-md);
  color: var(--color-foreground-action-neutral);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s ease, border-color 0.12s ease;
  margin-right: 32px;
  white-space: nowrap;
}

.tab-item:last-child {
  margin-right: 0;
}

.tab-item:hover {
  color: var(--color-foreground-action-accent);
}

.tab-item.is-active {
  color: var(--color-foreground-action-accent);
  font-weight: var(--font-weight-bold);
  border-bottom-color: var(--color-foreground-action-accent);
}

.tab-item.is-empty {
  opacity: 0.4;
  pointer-events: none;
}

.tab-item-count {
  font: var(--text-utility-component-badge);
  color: var(--color-foreground-content-secondary);
  padding: 0px 4px;
  height: 16px;
  background-color: var(--color-background-element-neutralsubtle);
  border-radius: var(--radius-sm);
}

.tab-item.is-active .tab-item-count {
  color: var(--color-foreground-action-accent);
}

/* ─── Main content ──────────────────────────────────────────────────────────── */

.main-content {
  flex: 1;
  padding: 24px;
  max-width: var(--page-max-width);
  width: 100%;
}

/* ─── Asset grid ────────────────────────────────────────────────────────────── */

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 24px;
}

/* Empty / no results state */
.grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--color-foreground-content-secondary);
  font-size: 14px;
}

.grid-empty-title {
  font-size: 16px;
  font-weight: var(--font-weight-bold);
  color: var(--color-foreground-content-primary);
  margin-bottom: 8px;
}

/* ─── Asset card ────────────────────────────────────────────────────────────── */

.asset-card {
  background: var(--color-background-element-default);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  width: 100%;
}

/* Preview area */
.asset-preview {
  width: 100%;
  height: 164px;
  background: var(--color-preview-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.asset-preview img {
  max-width: 75%;
  max-height: 75%;
  object-fit: contain;
}

/* Asset info */
.asset-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 4px;
}

.asset-name {
  font: var(--text-composition-title-heading-md);
  color: var(--color-foreground-content-primary);
  overflow: visible;
  cursor: default;
}

.asset-description {
  font: var(--text-composition-content-body-md);
  color: var(--color-foreground-content-secondary);
}

.metadata {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.asset-data {
  font: var(--text-utility-ui-label-sm);
  color: var(--color-foreground-content-secondary);
  line-height: 16px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.asset-data span {
  width: 12px;
  height: 12px;
  color: var(--color-foreground-action-neutral);
  overflow: visible;
  cursor: default;
}

.category-tag {
  font: var(--text-utility-component-badge);
  text-transform: var(--font-text-case-uppercase);
  color: var(--color-foreground-semantic-info);
  padding: 0px 4px;
  border-radius: var(--radius-xs);
  background: var(--color-background-semantic-infosubtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: -4px;
}

/* Asset actions */
.asset-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

/* ─── Menu button (dropdown trigger) ────────────────────────────────────────── */

.menu-btn {
  position: relative;
  width: 100%;
}

.menu-btn-trigger {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  background: var(--color-background-element-default);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: var(--text-utility-ui-label-md);
  color: var(--color-foreground-content-secondary);
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
  user-select: none;
}

.menu-btn-trigger:hover {
  background: var(--color-background-element-default-hover);
  color: var(--color-foreground-action-accent-hover);
  border-color: var(--color-border-accent-hover);
  box-shadow: 0 0 0 1px var(--color-border-accent-hover);
}

.menu-btn-trigger:hover .menu-btn-icon,
.menu-btn-trigger:hover .menu-btn-chevron {
  color: var(--color-foreground-action-accent-hover);
}

.menu-btn-trigger:active,
.menu-btn.is-open .menu-btn-trigger {
  background: var(--color-background-element-default-pressed);
  border-color: var(--color-border-accent-pressed);
  box-shadow: 0 0 0 1px var(--color-border-accent-pressed);
  color: var(--color-foreground-action-accent-pressed);
}

.menu-btn.is-open .menu-btn-trigger {
  background: var(--color-background-element-default-pressed);
  border-color: var(--color-border-accent-pressed);
  box-shadow: 0 0 0 1px var(--color-border-accent-pressed);
  color: var(--color-foreground-action-accent-pressed);
}

.menu-btn-left {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.menu-btn-label {
  white-space: nowrap;
}

.menu-btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-foreground-action-accent);
  display: none;
  align-items: center;
}

.menu-btn-icon img,
.menu-btn-icon svg {
  width: 16px;
  height: 16px;
}

.menu-btn-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-foreground-content-secondary);
  display: flex;
  align-items: center;
  transition: transform 0.15s ease;
}

.menu-btn-chevron img,
.menu-btn-chevron svg {
  width: 16px;
  height: 16px;
}

.menu-btn.is-open .menu-btn-chevron {
  transform: rotate(180deg);
}

/* ─── Options list (dropdown) ────────────────────────────────────────────────── */

.options-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-background-surface-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  display: none;
}

.menu-btn.is-open .options-list {
  display: block;
}

.option-item {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: var(--font-weight-regular);
  color: var(--color-foreground-content-secondary);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.option-item:hover {
  background: var(--color-background-element-default-hover);
  color: var(--color-foreground-action-accent);
}

.option-item:active {
  background: var(--color-background-element-default-pressed);
  color: var(--color-foreground-action-accent);
}

.option-item.is-highlighted {
  background: var(--color-background-element-default-hover);
  color: var(--color-foreground-action-accent);
}

/* ─── Pagination ─────────────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border-top: 1px solid var(--color-border);
}

.pagination-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: solid 1px var(--color-border);
  background: var(--color-background-element-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-foreground-action-neutral);
  transition: background 0.1s ease, color 0.1s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--color-background-element-default-hover);
  color: var(--color-foreground-action-accent-hover);
  border: solid 2px var(--color-border-accent-hover);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.pagination-btn img,
.pagination-btn svg {
  width: 16px;
  height: 16px;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: var(--text-utility-ui-label-sm);
  color: var(--color-foreground-content-primary);
  border: 1px solid transparent;
  background: var(--color-background-element-neutralsubtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.1s ease, background 0.1s ease;
}

.page-num:hover {
  color: var(--color-foreground-action-accent-hover);
  background: var(--color-background-element-accentsubtle);
  border-color: var(--color-foreground-action-accent-hover);
  border-width: 2px;
}

.page-num.is-active {
  color: var(--color-foreground-action-accent-pressed);
  border-color: var(--color-foreground-action-accent-pressed);
  border-width: 2px;
}

.page-num.is-ellipsis {
  cursor: default;
  background: transparent;
}

.page-num.is-ellipsis:hover {
  background: transparent;
  border-color: transparent;
}

/* ─── Toast / feedback ───────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--color-background-surface-contrast);
  color: var(--color-foreground-content-primary-on-contrast);
  font-size: 13px;
  font-weight: var(--font-weight-regular);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

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

/* ─── Loading / skeleton state ───────────────────────────────────────────────── */

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--color-foreground-content-secondary);
  font-size: 14px;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */

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

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

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

/* ─── Tooltip ────────────────────────────────────────────────────────────────── */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-background-surface-contrast);
  color: var(--color-foreground-content-primary-on-contrast);
  font: var(--text-utility-ui-label-sm);
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  transition-delay: 0s;
  z-index: 500;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transition-delay: 1s;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

/* Tablet — collapsed sidebar (icon-only), 3 columns */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 56px;
  }

  .sidebar {
    overflow: visible;
  }

  .sidebar-header {
    padding: 20px 0;
    justify-content: center;
  }

  /* Swap to icon-mark in collapsed state */
  .logo-full  { display: none; }
  .logo-mark  { display: block; width: 24px; height: 24px; }

  /* Hover-expand: sidebar floats above content at full default width.
     Only between 601px–1024px; the 600px layout uses a bottom bar instead. */
  @media (min-width: 601px) {
    .sidebar {
      overflow: hidden;
      transition: width 0.2s ease;
      z-index: 800;
    }

    .sidebar:hover {
      width: var(--sidebar-default-width, 240px);
      overflow: visible;
      box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    }

    /* Restore full logo when sidebar is expanded on hover */
    .sidebar:hover .logo-full  { display: block; }
    .sidebar:hover .logo-mark  { display: none; }

    .sidebar:hover .sidebar-header {
      padding: 24px 16px 20px;
      justify-content: flex-start;
    }

    .sidebar:hover .sidemenu-action {
      justify-content: flex-start;
      padding: 0 16px;
      width: 100%;
      margin: 0;
      border-radius: 0;
    }

    .sidebar:hover .sidemenu-action .action-label {
      position: static;
      transform: none;
      margin-left: 0;
      background: none;
      color: inherit;
      font: var(--text-utility-ui-label-md);
      padding: 0;
      border-radius: 0;
      opacity: 1;
      pointer-events: auto;
    }

    .sidebar:hover .sidebar-footer-author {
      padding: 24px 16px;
      justify-content: flex-start;
      width: 100%;
    }

    .sidebar:hover .sidebar-footer-author .footer-author-label {
      display: inline;
    }

    .sidebar:hover .sidebar-secondary {
      padding: 0;
      align-items: flex-start;
    }
  }

  .sidemenu-action {
    justify-content: center;
    padding: 0;
    height: 40px;
    width: 40px;
    margin: 0px auto;
    border-radius: var(--radius-sm);
    position: relative;
  }

  .sidemenu-action .line-active {
    display: none;
  }

  .sidemenu-action .action-label {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    background: var(--color-foreground-content-primary);
    color: var(--color-background-surface-base);
    font-size: 12px;
    font-weight: var(--font-weight-bold);
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 9999;
  }

  .sidemenu-action:hover .action-label,
  .sidemenu-action:focus .action-label {
    opacity: 1;
  }

  .sidebar-secondary {
    padding: 0;
    align-items: center;
  }

  .sidebar-footer-author {
    padding: 24px 0;
    justify-content: center;
  }

  .sidebar-footer-author .footer-author-label {
    display: none;
  }

  .page-header {
    padding: 24px;
  }

  .main-content {
    padding: 24px;
  }
}

/* Mobile — bottom nav, 2 columns */
@media (max-width: 600px) {
  .app {
    flex-direction: column;
    padding-bottom: 60px;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    min-width: unset;
    height: 56px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    z-index: 900;
    border-top: 1px solid var(--color-border);
    overflow: hidden;
  }

  .sidebar-header {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    padding: 0;
    gap: 0;
    flex: 1;
    justify-content: center;
  }

  .sidemenu-action {
    flex-direction: column;
    gap: 2px;
    height: 48px;
    width: auto;
    padding: 4px 16px;
    margin: 0;
    border-radius: 0;
  }

  .sidemenu-action .action-icon {
    width: 20px;
    height: 20px;
  }

  .sidemenu-action .action-icon svg {
    width: 20px;
    height: 20px;
  }

  .sidemenu-action .action-label {
    position: static;
    transform: none;
    margin-left: 0;
    background: none;
    color: inherit;
    font: var(--text-utility-ui-label-sm);
    padding: 0;
    border-radius: 0;
    opacity: 1;
    pointer-events: auto;
  }

  .sidemenu-action.is-active {
    background: transparent;
  }

  .sidemenu-action.is-active::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 25%;
    right: 25%;
    height: 3px;
    background: var(--color-foreground-action-accent);
    border-radius: 0 0 2px 2px;
  }

  .sidebar-secondary {
    display: none;
  }

  .page-header {
    padding: 20px 16px 16px;
  }

  .page-header-title {
    font-size: 22px;
  }

  .toolbar {
    padding: 0 16px;
    gap: 8px;
  }

  /* Search fills the space left by the icon-only filter */
  .search-field {
    flex: 1;
    width: auto;
  }

  /* Filter: square icon-only button */
  .filter-btn {
    margin-left: 0;
    flex-shrink: 0;
  }

  .filter-trigger {
    width: 40px;
    height: 40px;
    overflow: visible;  /* allow the count badge to float above the button */
  }

  .filter-trigger-main {
    padding: 0;
    justify-content: center;
    width: 40px;
  }

  .filter-desktop-label,
  .filter-chevron {
    display: none !important;
  }

  .filter-mobile-icon {
    display: flex;
  }

  /* Hide the clear-btn divider at mobile (the X badge replaces it) */
  .filter-clear-btn {
    display: none;
  }

  .tab-nav {
    padding: 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tabs {
    min-width: max-content;
  }

  .main-content {
    padding: 16px;
  }

  .asset-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .pagination {
    padding: 12px 16px;
  }

  .toast {
    bottom: 72px;
  }

  /* Icon-only action buttons */
  .menu-btn-trigger {
    width: 100%;
    height: 40px;
    padding: 0;
    justify-content: center;
  }

  .menu-btn-label,
  .menu-btn-chevron {
    display: none;
  }

  .menu-btn-icon {
    display: flex;
    margin: 0;
  }
}
