/* ==========================================================================
   Avezz Design System — UI Kit Primitives
   ========================================================================== */

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ==========================================================================
   01. Buttons
   ========================================================================== */
.btn {
  height: 36px;
  padding: 0 15px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.008em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.btn:active:not(:disabled) { transform: scale(0.975); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: #ffffff; }

.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 16%, transparent); }

.btn-secondary {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-muted); color: var(--text); }

.btn-danger { background: var(--negative); color: #ffffff; }
.btn-danger:hover:not(:disabled) { background: var(--negative-hover); color: #ffffff; }

.btn-danger-soft { background: var(--negative-bg); color: var(--negative); }
.btn-danger-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--negative) 16%, transparent); }

.btn-pill { border-radius: 999px; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; border-radius: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-lg { width: 42px; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.95); }

/* Sub-nav style + Create icon button (icon over small item name) */
.create-icon-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 52px;
  min-height: 46px;
  padding: 5px 10px 8px;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.create-icon-btn .icon {
  width: 21px;
  height: 21px;
}

.create-icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.create-icon-btn:active {
  transform: scale(0.96);
}

.modal-card--create {
  max-width: 600px;
}

.modal-card--wide {
  max-width: 680px;
}

.modal-card--narrow {
  max-width: 440px;
}

.modal-card--create .modal-body > .card {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}

.modal-card--create .modal-body > .card > .card-head {
  display: none;
}

.modal-card--create .modal-body > .card > .card-body {
  padding: 0;
}

.btn-group {
  display: inline-flex;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface-subtle);
}

.btn-group .btn {
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  height: 34px;
}

.btn-group .btn + .btn { border-left: 1px solid var(--border); }
.btn-group .btn:hover { background: var(--surface-hover); color: var(--text); }
.btn-group .btn.active { background: var(--surface); color: var(--text); font-weight: 600; }

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: avezz-spin 0.65s linear infinite;
}

@keyframes avezz-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   02. Inputs & Form Fields
   ========================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

.field-meta { font-size: 11.5px; color: var(--text-tertiary); }
.field-help { font-size: 12px; color: var(--text-secondary); }
.field-help.valid { color: var(--positive); }
.field-help.error { color: var(--negative); }

.input,
.textarea,
.select-native {
  width: 100%;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.input, .select-native { height: 38px; }
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }

.input:hover:not(:disabled),
.textarea:hover:not(:disabled),
.select-native:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.input:focus,
.textarea:focus,
.select-native:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.input:disabled,
.textarea:disabled,
.select-native:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--surface-muted);
}

.input.is-valid { border-color: var(--positive); }
.input.is-valid:focus { box-shadow: 0 0 0 3px var(--positive-bg); }
.input.is-error { border-color: var(--negative); }
.input.is-error:focus { box-shadow: 0 0 0 3px var(--negative-bg); }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-wrap .lead-icon {
  position: absolute;
  left: 11px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.input-wrap .input.has-lead { padding-left: 35px; }
.input-wrap .input.has-trail { padding-right: 36px; }

.input-action {
  position: absolute;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  transition: background 0.14s ease, color 0.14s ease;
}

.input-action:hover { background: var(--surface-hover); color: var(--text); }

.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input-group:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.input-addon {
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.input-addon.suffix { border-right: 0; border-left: 1px solid var(--border); }

.input-group input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 11px;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 38px;
  padding: 3px;
  gap: 2px;
}

.stepper-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: background 0.14s ease, color 0.14s ease;
}

.stepper-btn:hover { background: var(--surface-hover); color: var(--text); }
.stepper-val { min-width: 40px; text-align: center; font-size: 14px; font-weight: 600; }

.select-wrap { position: relative; width: 100%; }
.select-native { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.select-chevron {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.color-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 4px 10px 4px 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.color-picker {
  width: 26px;
  height: 26px;
  border: 0;
  padding: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: 1px solid var(--border-strong); border-radius: 7px; }
.color-hex { font-size: 13px; font-weight: 500; color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ==========================================================================
   03. Toggles, Checkboxes, Radios & Dropdowns
   ========================================================================== */
.control-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-subtle);
}

.control-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.control-item + .control-item { border-top: 1px solid var(--border); }
.control-item:hover { background: var(--surface-hover); }
.control-item.is-disabled { opacity: 0.48; cursor: not-allowed; }
.control-item.is-disabled:hover { background: transparent; }

.control-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.control-title { font-size: 13.5px; font-weight: 500; color: var(--text); }
.control-desc { font-size: 12px; color: var(--text-secondary); }

.switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--switch-off);
  position: relative;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.22s cubic-bezier(0.34, 1.35, 0.64, 1);
}

.switch input:checked + .switch-track { background: var(--switch-on); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--accent-ring); }

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
}

.check-row.is-disabled { opacity: 0.45; cursor: not-allowed; }

.check-input,
.radio-input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.check-input { border-radius: 6px; }
.radio-input { border-radius: 50%; }

.check-input:focus-visible,
.radio-input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.check-input:checked,
.check-input:indeterminate {
  background: var(--accent);
  border-color: var(--accent);
}

.check-input:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(0.5px, -1px);
}

.check-input:indeterminate::after {
  content: "";
  width: 9px;
  height: 2px;
  border-radius: 2px;
  background: #ffffff;
}

.radio-input:checked { border-color: var(--accent); background: var(--accent); }
.radio-input:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ffffff; }

.radio-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.radio-card {
  position: relative;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.radio-card:hover { background: var(--surface-hover); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card.selected {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.radio-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.radio-card-title { font-size: 13.5px; font-weight: 600; }
.radio-card-sub { font-size: 12px; color: var(--text-secondary); }
.radio-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
}
.radio-card.selected .radio-dot { border-color: var(--accent); background: var(--accent); }
.radio-card.selected .radio-dot::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #ffffff; }

/* Popover Dropdown */
.dropdown { position: relative; display: inline-block; width: 100%; }

.dropdown-trigger {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropdown-trigger:hover { border-color: var(--border-strong); }
.dropdown.open .dropdown-trigger {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px;
  box-shadow: var(--shadow-popover);
  display: none;
  flex-direction: column;
  gap: 2px;
}

.dropdown.open .dropdown-menu { display: flex; }

.dropdown-item {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  transition: background 0.12s ease;
}

.dropdown-item:hover { background: var(--surface-hover); }
.dropdown-item.selected { color: var(--accent); font-weight: 500; }

/* ==========================================================================
   04. Tabs, Segmented Control, Chips, Breadcrumbs & Pagination
   ========================================================================== */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--segment-bg);
  gap: 2px;
  width: fit-content;
  max-width: 100%;
}

.seg-btn {
  padding: 6px 14px;
  border-radius: 8.5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--segment-active);
  color: var(--text);
  box-shadow: var(--segment-shadow);
}

.tab-panel {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-secondary);
}
.tab-panel strong { color: var(--text); font-weight: 600; }

.underline-tabs {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.utab {
  position: relative;
  padding: 9px 2px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.utab:hover { color: var(--text); }
.utab.active { color: var(--text); }
.utab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.chip {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .crumb-current { color: var(--text); font-weight: 500; }
.breadcrumbs .crumb-sep { color: var(--text-tertiary); }

.pagination { display: inline-flex; align-items: center; gap: 4px; }

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s ease, color 0.14s ease;
}

.page-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.page-btn.active { background: var(--accent); color: #ffffff; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ==========================================================================
   05. Sliders, Progress & Rating
   ========================================================================== */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--pct, 60%), var(--segment-bg) var(--pct, 60%), var(--segment-bg) 100%);
  outline: none;
  cursor: pointer;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: transform 0.12s ease;
}

.range::-webkit-slider-thumb:hover { transform: scale(1.08); }
.range::-moz-range-thumb {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--segment-bg);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.indeterminate {
  width: 38%;
  position: absolute;
  animation: avezz-indeterminate 1.4s ease-in-out infinite;
}

@keyframes avezz-indeterminate {
  0% { left: -40%; }
  100% { left: 105%; }
}

.ring-wrap { display: inline-flex; align-items: center; gap: 12px; }
.ring-svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--segment-bg); stroke-width: 4; }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.28s ease;
}

.stars { display: inline-flex; align-items: center; gap: 3px; }
.star-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  transition: transform 0.12s ease, color 0.14s ease;
}
.star-btn:hover { transform: scale(1.12); }
.star-btn.filled { color: var(--star); }

/* Canonical Star Rating System (from avezz.com) */
.star-rating {
  padding: 0;
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.star-rating.extinct {
  pointer-events: none;
  cursor: default;
}

.star-rating .star {
  line-height: 1;
  color: var(--border-strong, #cbd5e1);
  transition: color 0.18s ease;
}

.star-rating:hover .star {
  color: var(--border-strong, #cbd5e1);
}

.star-rating .star:hover,
.star-rating .star:hover ~ .star,
.star-rating .star.active {
  color: var(--star, #f59e0b);
}

/* ==========================================================================
   06. Image Upload & Tag Input
   ========================================================================== */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  padding: 24px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
}

.dropzone-title { font-size: 13.5px; font-weight: 600; }
.dropzone-sub { font-size: 12px; color: var(--text-secondary); }

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.upload-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }

.upload-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  color: #ffffff;
  display: grid;
  place-items: center;
  transition: background 0.14s ease, transform 0.12s ease;
}

.upload-remove:hover { background: var(--negative); transform: scale(1.06); }

.upload-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 6px;
  font-size: 10.5px;
  color: #ffffff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-upload { display: flex; align-items: center; gap: 14px; }
.avatar-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.tag-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.tag-box:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
}

.tag-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
}

.tag-remove:hover { background: var(--surface-hover); color: var(--text); }

.tag-input {
  flex: 1;
  min-width: 100px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 13.5px;
  padding: 0 4px;
}

.cat-pill-wrap {
  position: relative;
  width: 100%;
}

.cat-pill-source {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
  padding: 0;
  border: 0;
}

.cat-pill-wrap .tag-box {
  cursor: text;
}

.cat-pill-wrap .tag-pill {
  color: var(--text);
  line-height: 1.25;
}

.cat-pill-wrap .tag-remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.cat-suggest-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 10px 28px rgba(0, 0, 0, 0.14));
}

.cat-suggest-menu.hide {
  display: none;
}

.cat-suggest-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.cat-suggest-item:hover,
.cat-suggest-item.is-active {
  background: var(--surface-hover);
}

.cat-suggest-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-suggest-count {
  font-size: 11.5px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ==========================================================================
   07. Badges, Avatars, Callouts, Accordion, Table, Tooltip, Skeleton
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-positive { background: var(--positive-bg); color: var(--positive); }
.badge-pending { background: var(--pending-bg); color: var(--pending); }
.badge-negative { background: var(--negative-bg); color: var(--negative); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-secondary); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 46px; height: 46px; font-size: 15px; }

.avatar-online::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--switch-on);
  border: 2px solid var(--surface);
}

.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid transparent;
}

.alert-info { background: var(--accent-soft); color: var(--accent); }
.alert-success { background: var(--positive-bg); color: var(--positive); }
.alert-warning { background: var(--pending-bg); color: var(--pending); }
.alert-error { background: var(--negative-bg); color: var(--negative); }
.alert-body { flex: 1; color: var(--text); }
.alert-title { font-weight: 600; margin-bottom: 1px; }
.alert-text { color: var(--text-secondary); font-size: 12.5px; }

.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-subtle);
}

.acc-item + .acc-item { border-top: 1px solid var(--border); }

.acc-item summary {
  list-style: none;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.14s ease;
}

.acc-item summary::-webkit-details-marker { display: none; }
.acc-item summary:hover { background: var(--surface-hover); }
.acc-chevron { color: var(--text-tertiary); transition: transform 0.2s ease; }
.acc-item[open] .acc-chevron { transform: rotate(180deg); }
.acc-content { padding: 0 14px 13px; font-size: 13px; color: var(--text-secondary); line-height: 1.55; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.table-wrap th {
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-wrap td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover { background: var(--surface-subtle); }

[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--surface-hover) 50%, var(--surface-muted) 75%);
  background-size: 200% 100%;
  animation: avezz-shimmer 1.5s infinite linear;
}

@keyframes avezz-shimmer { to { background-position: -200% 0; } }

/* ==========================================================================
   08. Modals & Toasts (Apple-Style Desktop + Near-Fullscreen Mobile)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  place-items: center;
  padding: 28px;
}

.modal-backdrop.open { display: grid; }

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: avezz-modal-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes avezz-modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  background: var(--surface);
}

.modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.modal-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.modal-body {
  padding: 22px 26px;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-body form.col {
  gap: 16px;
}

.modal-foot {
  padding: 14px 26px;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.modal-foot--split {
  justify-content: space-between;
}

.modal-foot-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

@media (max-width: 680px) {
  .modal-backdrop {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    place-items: stretch;
  }

  .modal-card,
  .modal-card--create,
  .modal-card--wide,
  .modal-card--narrow {
    max-width: none;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 18px;
  }

  .modal-head {
    padding: 16px 18px 14px;
  }

  .modal-body {
    padding: 18px;
    gap: 14px;
  }

  .modal-foot {
    padding: 12px 18px;
  }
}

/* ==========================================================================
   08B. Spacious Form Controls, Dropzones & Canvas Rotation Captcha
   ========================================================================== */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 560px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.form-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.form-switch-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.form-switch-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.form-switch-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.form-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.form-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Password Strength Meter */
.pw-strength {
  display: grid;
  gap: 5px;
}

.pw-strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.pw-strength-bars span {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-muted);
  transition: background 0.18s ease;
}

.pw-strength[data-level="1"] .pw-strength-bars span:nth-child(1) { background: var(--negative); }
.pw-strength[data-level="2"] .pw-strength-bars span:nth-child(-n+2) { background: var(--pending); }
.pw-strength[data-level="3"] .pw-strength-bars span:nth-child(-n+3) { background: var(--accent); }
.pw-strength[data-level="4"] .pw-strength-bars span { background: var(--positive); }

.pw-strength-label {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* Drag-and-Drop Single & Multi Image Upload */
.upCon {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upCon > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}

.dropzone-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dropzone-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.dropzone-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.upCon .upload {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.upCon .upload img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.upCon .upload > button {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--negative);
  background: var(--negative-bg);
  transition: background 0.15s ease;
}

.upCon .upload > button:hover {
  background: color-mix(in srgb, var(--negative) 20%, transparent);
}

/* Multi-Image Gallery Slot Grid */
.listEditor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.listEditor .listTemp {
  display: none;
}

.listEditor .listCon.wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 10px;
}

.upload-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border-strong);
  background: var(--surface-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-card:hover,
.upload-card.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-card .upload-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.upload-card .upload-label input[type="file"] {
  display: none;
}

.upload-card .control {
  position: absolute;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
}

.upload-card input.control {
  width: 32px;
  text-align: center;
  padding: 0;
}

.upload-card .top-left { top: 6px; left: 6px; }
.upload-card .top-right { top: 6px; right: 6px; }
.upload-card .bottom-left { bottom: 6px; left: 6px; }
.upload-card .bottom-right { bottom: 6px; right: 6px; }

.listEditor .piece > input[type="text"] {
  width: 100%;
  margin-top: 6px;
}

.listEditor .piece.flex.autoSize {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* HTML5 Canvas Rotation Captcha */
.captcha-slot.hide { display: none; }

.captcha-box {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  padding: 14px;
  display: grid;
  gap: 12px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.captcha-box.is-verified {
  border-color: var(--positive);
  background: color-mix(in srgb, var(--positive-bg) 50%, var(--surface));
}

.captcha-box.is-error {
  border-color: var(--negative);
  animation: avezz-captcha-shake 0.34s ease;
}

@keyframes avezz-captcha-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.captcha-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.captcha-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captcha-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.captcha-box.is-verified .captcha-dot { background: var(--positive); }
.captcha-box.is-error .captcha-dot { background: var(--negative); }

.captcha-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.captcha-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.captcha-box.is-verified .captcha-status { color: var(--positive); }
.captcha-box.is-error .captcha-status { color: var(--negative); }

.captcha-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  overflow: hidden;
  background: #141d2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
  user-select: none;
  touch-action: none;
  outline: none;
}

.captcha-stage:active { cursor: grabbing; }
.captcha-stage:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }

.captcha-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.captcha-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 29, 46, 0.72);
  color: rgba(248, 250, 252, 0.85);
  font-size: 12.5px;
  font-weight: 500;
}

.captcha-angle-pill {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.74);
  backdrop-filter: blur(8px);
  color: #f8fafc;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.captcha-hint-pill {
  position: absolute;
  bottom: 9px;
  left: 9px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.68);
  color: rgba(248, 250, 252, 0.84);
  font-size: 11px;
  pointer-events: none;
}

.captcha-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.captcha-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border-strong);
  outline: none;
}

.captcha-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.captcha-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.captcha-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 340px;
  padding: 11px 14px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-popover);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  animation: avezz-toast-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes avezz-toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 820px) {
  .radio-cards { grid-template-columns: 1fr; }
}

/* Universal Card Dropdown Menus (Save to Pack & More) */
.card-menu-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.card-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-popover);
  padding: 5px;
  z-index: 80;
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.card-dropdown-menu.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.card-menu-label {
  padding: 5px 10px 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.card-menu-item {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.card-menu-item:hover {
  background: var(--surface-alt);
  text-decoration: none;
}

.card-menu-item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card-menu-item.is-saved {
  background: var(--accent-soft);
  color: var(--accent);
}

.card-menu-item.danger {
  color: var(--negative);
}

.card-menu-item.danger:hover {
  background: var(--negative-bg);
}

.card-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 2px;
}

.card-menu-status {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.has-open-menu {
  z-index: 60 !important;
}

/* Unified Post-Card Social Action Buttons */
:root {
  --action-badge-bg: #030712;
  --action-badge-txt: #ffffff;
}

[data-theme="dark"] {
  --action-badge-bg: #f3f4f6;
  --action-badge-txt: #111827;
}

.action-group {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover { text-decoration: none; }
.action-btn:active { transform: scale(0.92); }
.action-icon { width: 17px; height: 17px; display: block; }
.action-label { font-size: 8.5px; font-weight: 900; letter-spacing: -0.02em; line-height: 1; text-transform: uppercase; }

.btn-like:hover, .btn-like.active       { color: #4f46e5; }
.btn-dislike:hover, .btn-dislike.active { color: var(--text); }
.btn-fav:hover, .btn-fav.active         { color: #f43f5e; }
.btn-talk:hover, .btn-talk.active       { color: #3b82f6; }
.btn-save:hover, .btn-save.active       { color: #059669; }
.btn-more { padding: 4px 0; }
.btn-more:hover                         { color: var(--text); }

@keyframes popAction {
  0% { transform: scale(1); }
  50% { transform: scale(1.32); }
  100% { transform: scale(1); }
}
.action-btn.pop .action-icon { animation: popAction 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

.action-badge {
  position: absolute;
  top: -8px;
  right: -7px;
  background: var(--action-badge-bg);
  color: var(--action-badge-txt);
  font-size: 8px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 9999px;
  border: 2px solid var(--surface);
  line-height: 1.25;
  pointer-events: none;
}

/* ==========================================================================
   Universal Card (Market-style Card + 2-Line Description + Post Card Socials)
   Shared across Advanced Search & Profile tabs
   ========================================================================== */
.u-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 15px;
  min-width: 0;
}

.u-card-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.u-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease, border-color 0.15s ease;
}

.u-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.u-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-alt);
  overflow: hidden;
}

.u-media::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 46%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.54), transparent);
  pointer-events: none;
  z-index: 1;
}

.u-media-link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

.u-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.u-card:hover .u-media img { transform: scale(1.04); }

.u-media-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--surface-alt), var(--surface-hover));
  color: var(--text-tertiary, var(--text-muted));
  font-size: 11.5px;
  font-weight: 700;
}

/* Text-Only Quote Card Stage (mirrors Snaps Post Quote Stage) */
.u-card[data-u-quote] .u-media::after {
  height: 30%;
  background: linear-gradient(to top, rgba(8, 10, 15, 0.45), transparent);
}

.u-card[data-u-quote="post"] .u-media {
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 210px;
}

.u-card[data-u-quote="post"] .u-body {
  flex: 0 0 auto;
  padding: 0 12px 10px;
}

.u-card[data-u-quote="post"] .u-card-foot {
  border-top: 0;
  padding-top: 9px;
}

.u-quote-stage {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 36px 18px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  background:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.24), transparent 54%),
    radial-gradient(circle at 80% 78%, rgba(168, 85, 247, 0.22), transparent 56%),
    linear-gradient(155deg, #0f172a 0%, #171c2b 52%, #0c0f17 100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.u-card[data-u-quote]:hover .u-quote-stage {
  transform: scale(1.02);
}

.u-quote-mark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 36px;
  line-height: 0.62;
  color: rgba(255, 255, 255, 0.24);
  user-select: none;
}

.u-quote-text {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.38;
  letter-spacing: -0.01em;
  color: #f8fafc;
  text-wrap: balance;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-quote-text--long {
  font-size: 13.5px;
  line-height: 1.44;
  -webkit-line-clamp: 5;
}

.u-card[data-u-quote="post"] .u-quote-text {
  -webkit-line-clamp: 5;
}

.u-card[data-u-quote="post"] .u-quote-text--long {
  -webkit-line-clamp: 6;
}

.u-type-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.u-meta-pill {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(37, 99, 235, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.u-tags {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 8px;
  z-index: 3;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  overflow: hidden;
}

.u-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #f8fafc;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: background 0.14s ease;
}

.u-tag:hover {
  background: rgba(15, 23, 42, 0.82);
  color: #ffffff;
}

.u-body {
  padding: 11px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.u-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  display: block;
}

.u-title:hover { color: var(--accent); }

.u-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.42;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.u-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.u-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
}

.u-author:hover { color: var(--text); }

.u-avatar {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.u-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.u-avatar span { z-index: 1; }

.u-author-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.u-card-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.u-card-foot .action-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  margin-left: 0;
}

.u-card-foot--with-author .u-author {
  flex: 1 1 auto;
  min-width: 0;
}

.u-card-foot--with-author .action-group {
  width: auto;
  flex-shrink: 0;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.u-card-foot .action-icon {
  width: 15px;
  height: 15px;
}

.u-card-foot .action-label {
  font-size: 8px;
}

.u-card-foot--user {
  display: flex;
}

.u-user-cta {
  width: 100%;
  justify-content: center;
}

@media (max-width: 1120px) {
  .u-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .u-card-grid,
  .u-card-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .u-card-grid,
  .u-card-grid--3 { grid-template-columns: 1fr; }
}
