/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { width: 100%; overflow-x: clip; }
body { width: 100%; }

img.emoji {
  height: 1em !important;
  width: 1em !important;
  vertical-align: -0.15em;
  display: inline;
}

/* Tags are emoji-only chips — needs to be readable at a fixed size */
.tag img.emoji {
  height: 1.25rem !important;
  width: 1.25rem !important;
  vertical-align: middle;
}

:root {
  --bg: #faf8fd;
  --surface: #ffffff;
  --primary: #6b4d8a;
  --primary-light: #9b7db8;
  --accent: #b89ac8;
  --text: #201530;
  --text-muted: #7a6890;
  --border: #e5dcf0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(107,77,138,.10);
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #1a1525;
  --surface:      #251e35;
  --primary:      #b89ac8;
  --primary-light:#cdb5db;
  --accent:       #b89ac8;
  --text:         #f3eff8;
  --text-muted:   #c4b8d4;
  --border:       #3d3355;
  --shadow:       0 2px 12px rgba(0,0,0,.5);
}
[data-theme="dark"] .category-item.active            { background: rgba(184,154,200,.12); }
[data-theme="dark"] .category-item.active .cat-count { background: #3d3355; }
[data-theme="dark"] .browse-category-badge           { background: rgba(184,154,200,.12); }
[data-theme="dark"] .tag-primary                     { background: rgba(184,154,200,.18); }
[data-theme="dark"] .tag-secondary                   { background: #3d3355; }
[data-theme="dark"] .badge-draft                     { background: #2a2040; color: #cdb5db; }
[data-theme="dark"] .draft-field--missing .draft-field-label,
[data-theme="dark"] .draft-missing-text,
[data-theme="dark"] .draft-missing                   { color: #cdb5db; }
[data-theme="dark"] .draft-chip--missing             { background: rgba(184,154,200,.15); color: #cdb5db; }
[data-theme="dark"] .detail-category                 { background: rgba(184,154,200,.12); color: var(--primary); }
[data-theme="dark"] .card:hover                      { box-shadow: 0 6px 20px rgba(0,0,0,.5); }
[data-theme="dark"] .btn                             { color: #f3eff8; }
[data-theme="dark"] .btn-ghost                       { color: var(--primary); background: transparent; }
[data-theme="dark"] .btn-ghost:hover                 { background: rgba(184,154,200,.12); }
[data-theme="dark"] .btn-danger                      { color: #f3eff8; }

body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
header, main, footer { width: 100%; min-width: 0; max-width: 100%; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: .72rem 1.8rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  width: 100%; box-sizing: border-box;
}
.navbar-top {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  min-width: 0;
}
.brand { font-size: 1.38rem; font-weight: bold; color: var(--primary); white-space: nowrap; flex-shrink: 0; display: flex; align-items: center; gap: .4rem; }
.brand-logo { width: 4rem; height: 4rem; object-fit: contain; flex-shrink: 0; }

/* Right-side group in navbar-top */
.navbar-top-right {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-left: auto;
  flex-shrink: 0;
}

/* Search — drops below navbar */
.nav-search-bar {
  position: relative;
  padding: .35rem 0 .2rem;
}
.nav-search-form {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: .4rem .5rem .4rem 1rem;
}
.nav-search-form:focus-within { border-color: var(--primary); }
.nav-search-suggestions {
  position: absolute;
  top: calc(100% - .35rem);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  list-style: none;
  margin: 0; padding: .3rem 0;
  z-index: 200;
}
.nav-sugg-item { display: flex; align-items: center; gap: .6rem; padding: .4rem .7rem; font-size: .9rem; cursor: pointer; }
.nav-sugg-item:hover, .nav-sugg-item--focused { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.nav-sugg-img { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.nav-sugg-img--empty { display: flex; align-items: center; justify-content: center; background: var(--border); font-size: 1.2rem; }
.nav-sugg-text { display: flex; flex-direction: column; min-width: 0; }
.nav-sugg-brand { font-size: .72rem; color: var(--text-muted); }
.nav-sugg-name { font-size: .88rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-search-input { flex: 1; border: none !important; background: none !important; box-shadow: none !important; outline: none !important; font-size: 1.06rem; color: var(--text); font-family: inherit; padding: 0; min-width: 0; width: auto; }
.nav-search-input::placeholder { color: var(--text-muted); }

/* Nav links second row */
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1rem;
  align-items: center;
  font-size: .9rem;
  border-top: 1px solid var(--border);
  padding-top: .4rem;
  width: 100%;
}
.nav-links a { color: var(--text-muted); }
.nav-links a:hover { color: var(--primary); }
.nav-viewing-badge { font-size: .75rem; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); border-radius: 20px; padding: 2px 10px; white-space: nowrap; }
.nav-hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: .25rem; flex-shrink: 0; }

/* Mobile: hide links behind hamburger */
@media (max-width: 600px) {
  .nav-links { display: none; flex-direction: column; align-items: flex-start; border-top: 1px solid var(--border); padding-top: .5rem; }
  .nav-links--open { display: flex; }
  .nav-links form { display: block; }
  .nav-hamburger { display: flex; align-items: center; }
  .navbar { padding: .55rem .9rem; }
  .brand-logo { width: 2rem; height: 2rem; }
  .brand { font-size: 1.1rem; }
  .navbar-top-right { flex-shrink: 1; min-width: 0; gap: .35rem; }
  .nav-wearing-btn-text, .nav-wearing-caret { display: none; }
  .nav-wearing-btn { padding: .3rem; border: none; background: none; max-width: unset; gap: 0; }
  .nav-wearing-btn:hover { box-shadow: none; }
}
.clear-search { font-size: .75rem; color: var(--text-muted); text-decoration: none; margin-left: .25rem; }
.clear-search:hover { color: var(--primary); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container { width: 100%; min-width: 0; padding: 2rem 1.5rem; flex: 1; box-sizing: border-box; }
footer { text-align: center; padding: 1.5rem; color: var(--text-muted); font-size: .85rem; border-top: 1px solid var(--border); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .5rem 1.25rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  font-family: inherit;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--primary-light); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #b94040; }
.btn-danger:hover { background: #8c3030; }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.link-btn { background: none; border: none; font: inherit; cursor: pointer; color: var(--text-muted); padding: 0; }
.link-btn:hover { color: var(--primary); text-decoration: underline; }
.theme-toggle {
  display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: .2rem; gap: .1rem;
}
.theme-toggle-btn {
  background: none; border: none; cursor: pointer;
  border-radius: 16px; font-size: 1rem;
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, box-shadow .15s;
}
.theme-toggle-btn--active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* ── Search ──────────────────────────────────────────────────────────────── */
/* ── Browse layout ───────────────────────────────────────────────────────── */
.browse-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}
/* ── Category sidebar ─────────────────────────────────────────────────────── */
.category-details { display: block; }
.category-summary { display: none; }
.filter-fab { display: none; }
.filter-fab-backdrop { display: none; }

@media (max-width: 1150px) {
  .browse-layout { grid-template-columns: 180px 1fr; gap: 1rem; }
}

@media (max-width: 720px) {
  .browse-layout { grid-template-columns: 1fr; }

  /* Details stays in grid but invisible — sidebar panel is the actual drawer */
  .category-details { display: none; }

  .category-sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100dvh;
    width: min(300px, 85vw);
    z-index: 200;
    transform: translateX(-105%);
    transition: transform .25s ease;
    overflow-y: auto;
    border: none;
    border-radius: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
  }
  .category-sidebar.is-open { transform: translateX(0); }

  /* Backdrop */
  .filter-fab-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0,0,0,.35);
  }
  .filter-fab-backdrop[hidden] { display: none; }

  /* Floating action button */
  .filter-fab {
    display: flex;
    align-items: center;
    gap: .4rem;
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 198;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 2rem;
    padding: .6rem 1.1rem;
    font-size: .9rem;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(0,0,0,.25);
    cursor: pointer;
  }
}

.category-details {
  position: sticky;
  top: 4rem;
  max-height: calc(100vh - 5rem);
  align-self: start;
}

.category-sidebar {
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0;
}
.sidebar-heading {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: 0 1rem .5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .25rem;
}
.category-list { list-style: none; }
.sidebar-divider { border: none; border-top: 1px solid white; margin: .75rem 1rem; opacity: 0.5; }
[data-theme="dark"] .sidebar-divider { border-top-color: white; opacity: 0.2; }
.sidebar-heading { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); padding: .4rem 1rem 0; margin: 0; }
.sidebar-section { border: none; }
.sidebar-section-heading {
  font-size: .7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: .5rem 1rem .3rem;
  margin: 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sidebar-section-heading::-webkit-details-marker { display: none; }
.sidebar-section-heading::after {
  content: '';
  display: inline-block;
  width: .5em;
  height: .5em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s;
  margin-right: .25rem;
}
.sidebar-section[open] .sidebar-section-heading::after {
  transform: rotate(-135deg);
}
.category-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem 1rem;
  color: var(--text);
  font-size: .9rem;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .1s, border-color .1s;
}
.category-item:hover { background: var(--bg); text-decoration: none; }
.category-item.active { border-left-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--bg)); color: var(--primary); font-weight: bold; }
.category-item--check { cursor: pointer; flex-direction: row; align-items: center; font-weight: normal; color: var(--text); }
.category-item--check input[type="checkbox"] { display: none; }
.active-accord-chips { display: flex; flex-wrap: wrap; gap: .35rem; padding: .5rem .75rem .25rem; }
.active-accord-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: 3px 8px 3px 7px; border-radius: 20px; border: 1.5px solid color-mix(in srgb, var(--accord-color) 50%, transparent); background: color-mix(in srgb, var(--accord-color) 18%, var(--surface)); color: color-mix(in srgb, var(--accord-color) 85%, var(--text)); cursor: pointer; transition: background .12s; }
.active-accord-chip:hover { background: color-mix(in srgb, var(--accord-color) 30%, var(--surface)); }
.active-accord-remove { font-size: .9rem; line-height: 1; opacity: .7; margin-left: .1rem; }
.cat-emoji { font-size: 1rem; flex-shrink: 0; }
.cat-name { flex: 1; }
.cat-count { font-size: .75rem; color: var(--text-muted); background: var(--bg); border-radius: 20px; padding: .1rem .45rem; }
.category-item.active .cat-count { background: #f5e1d0; }

.browse-main { min-width: 0; }
.browse-header { margin-bottom: 2rem; }
.collection-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.collection-tab {
  padding: .45rem 1.1rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius) var(--radius) 0 0;
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -2px;
  transition: color .15s, background .15s;
}
.collection-tab:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); text-decoration: none; }
.collection-tab--active {
  color: var(--primary);
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
}
.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: .5rem;
}
.wardrobe-bottle {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.wardrobe-bottle:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.wardrobe-bottle img { width: 100%; height: 100%; object-fit: cover; }
.wardrobe-bottle-empty { font-size: 1.8rem; }

.browse-title { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.browse-category-badge { font-size: .85rem; font-weight: bold; color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--bg)); border-radius: 20px; padding: .2rem .75rem; }

/* ── View toggle ──────────────────────────────────────────────────────────── */
.view-toggle { display: flex; gap: .25rem; margin-left: auto; }
.view-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: .3rem .5rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.view-btn:hover { border-color: var(--primary); color: var(--primary); }
.view-btn--active { background: var(--primary); border-color: var(--primary); color: white; }

.sort-picker { position: relative; }
.sort-picker-btn { display: flex; align-items: center; list-style: none; }
.sort-picker-btn::-webkit-details-marker { display: none; }
.sort-menu { position: absolute; top: calc(100% + 4px); right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .35rem 0; list-style: none; min-width: 140px; z-index: 20; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.sort-option { display: block; padding: .45rem .9rem; font-size: .88rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.sort-option:hover { background: var(--bg); color: var(--primary); }
.sort-option--active { color: var(--primary); font-weight: 600; }

/* ── Perfume grid view ────────────────────────────────────────────────────── */
.perfume-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: .75rem;
}
.perfume-grid-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  background: color-mix(in srgb, var(--card-accent, transparent) 15%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--card-accent, transparent) 40%, var(--border));
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .15s, border-color .15s;
  overflow: hidden;
}
.perfume-grid-card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--card-accent, transparent) 70%, var(--border)); text-decoration: none; }
.perfume-grid-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  display: block;
  flex-shrink: 0;
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
}
.perfume-grid-img--missing {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 200px;
  font-size: 3rem;
  background: var(--bg);
  border-radius: 8px;
  margin: .5rem auto 0;
  color: var(--text-muted);
}
.perfume-grid-info {
  padding: .5rem .6rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.perfume-grid-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.result-count { font-size: .8rem; color: var(--text-muted); margin-left: auto; }

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-form { display: flex; gap: .75rem; }
.search-input {
  flex: 1;
  padding: .6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
}
.search-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.search-hint { color: var(--text-muted); font-size: .9rem; }

/* ── Card grid ───────────────────────────────────────────────────────────── */
.card {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  padding: .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
  color: var(--text);
  text-decoration: none;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(107,76,59,.15); text-decoration: none; }
.card-draft { border-style: dashed; opacity: .8; }

/* ── Draft grid ──────────────────────────────────────────────────────────── */
.draft-count { font-size: .9rem; font-weight: normal; color: var(--text-muted); margin-left: .5rem; }

.draft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 1.25rem;
}

.draft-card {
  display: flex;
  gap: 1rem;
  background: color-mix(in srgb, var(--card-accent, transparent) 15%, var(--surface));
  border: 2px dashed color-mix(in srgb, var(--card-accent, transparent) 40%, var(--border));
  border-radius: var(--radius);
  padding: .85rem;
  color: var(--text);
  text-decoration: none;
  transition: box-shadow .15s, border-color .15s;
}
.draft-card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--card-accent, transparent) 70%, var(--border)); text-decoration: none; }
.draft-card--published { border-style: solid; }
.draft-card--archived { border-style: solid; opacity: 0.75; }
.draft-card-wrap { display: flex; flex-direction: column; gap: .4rem; }
.draft-card-wrap .draft-card { flex: 1; }
.draft-archive-form { display: flex; justify-content: flex-end; }

.draft-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  flex-shrink: 0;
}
.draft-img--missing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--bg);
  color: var(--text-muted);
  gap: .2rem;
}
.draft-img--missing span { font-size: .6rem; text-transform: uppercase; letter-spacing: .06em; }

.draft-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .5rem; }

.draft-identity { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .5rem; }
.draft-category { font-size: .7rem; font-weight: bold; text-transform: uppercase; letter-spacing: .07em; color: var(--primary-light); }
.draft-brand { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.draft-name { font-size: .95rem; }
.draft-badge { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; vertical-align: middle; }
.draft-accords { display: flex; flex-wrap: wrap; gap: .3rem; }
.accord-chip { font-size: .75rem; background: color-mix(in srgb, var(--accord-color, transparent) 30%, transparent); border: 1px solid color-mix(in srgb, var(--accord-color, transparent) 60%, transparent); border-radius: 20px; padding: 2px 8px; color: var(--text); white-space: nowrap; }
.accord-chip--sm { font-size: .7rem; padding: 1px 6px; }
.grid-accords { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .3rem; }
.draft-ml { font-size: .75rem; color: var(--text-muted); }

.draft-field { display: flex; flex-direction: column; gap: .15rem; font-size: .8rem; }
.draft-field-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.draft-field--missing .draft-field-label { color: #c0783a; }
.draft-notes-text { color: var(--text); line-height: 1.4; }
.draft-desc-text { color: var(--text-muted); line-height: 1.4; }
.draft-dupe { font-size: .8rem; }
.dupe-label { font-weight: 600; color: var(--text-muted); }
.dupe-name { color: var(--text); font-style: italic; }
.detail-dupe { font-size: .95rem; margin-bottom: 1.5rem; }
.detail-dupe .dupe-label { font-weight: 700; color: var(--text-muted); margin-right: .3rem; }
.draft-missing-text { color: #c0783a; font-style: italic; }
.draft-missing { font-size: .7rem; color: #c0783a; font-style: italic; }

.note-tier-inline { display: block; color: var(--text-muted); }
.note-tier-inline em { font-style: normal; font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-right: .25rem; }

.draft-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; padding-top: .25rem; }
.draft-chip {
  font-size: .72rem;
  padding: .15rem .45rem;
  border-radius: 20px;
  background: var(--border);
  color: var(--text-muted);
  white-space: nowrap;
  position: relative;
}
.draft-chip--missing { background: #fdf0e6; color: #c0783a; }
.rating-chip { display: inline-block; font-size: 1rem; padding: .15rem .35rem; border-radius: 6px; position: relative; }
.card-img { width: 80px; height: 100px; object-fit: cover; object-position: center; border-radius: 8px; flex-shrink: 0; }
.card-img--missing { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.6rem; background: var(--bg); color: var(--text-muted); gap: .2rem; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.card-category { display: block; font-size: .7rem; font-weight: bold; text-transform: uppercase; letter-spacing: .07em; color: var(--primary-light); margin-bottom: .15rem; }
.card-brand { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.card-name { font-size: 1rem; font-weight: bold; line-height: 1.3; }
.card-rating { font-size: 1.1rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.card-notes { margin-top: auto; font-size: .75rem; }
.card-desc { font-size: .75rem; color: var(--text-muted); line-height: 1.4; margin-top: .2rem; }

/* ── Tags ────────────────────────────────────────────────────────────────── */
.tag { display: inline-block; font-size: 1rem; border-radius: 6px; padding: .15rem .35rem; position: relative; }
.tag-primary { background: #f5e6d8; }
.tag-secondary { background: #eef0f5; font-size: .85rem; }

.tag[data-label]::after,
.draft-chip[data-label]::after,
.rating-chip[data-label]::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: .75rem;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  white-space: nowrap;
  padding: .25rem .55rem;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 10;
}
.tag[data-label]:hover::after,
.draft-chip[data-label]:hover::after,
.rating-chip[data-label]:hover::after { opacity: 1; }
.badge { display: inline-block; font-size: .7rem; padding: .15rem .5rem; border-radius: 20px; background: var(--border); color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.badge-draft { background: #f5e6c0; color: #7a5a10; }

/* ── Detail page ─────────────────────────────────────────────────────────── */
.perfume-detail { max-width: 820px; margin: 0 auto; min-width: 0; }
.detail-hero { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; margin-bottom: 2rem; }
.detail-img-wrap { display: flex; flex-direction: column; gap: .5rem; flex-shrink: 0; }
.detail-carousel { position: relative; display: inline-block; }
.detail-img { width: 280px; max-width: 100%; height: 280px; border-radius: var(--radius); box-shadow: var(--shadow); object-fit: cover; display: block; }
.detail-carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border: 1px solid var(--border); border-radius: 50%;
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity .15s;
  color: var(--text);
}
.detail-carousel:hover .detail-carousel-arrow { opacity: 1; }
.detail-carousel-arrow--prev { left: .4rem; }
.detail-carousel-arrow--next { right: .4rem; }
.detail-img-thumbs { display: flex; gap: .4rem; flex-wrap: wrap; max-width: 280px; }
.detail-img-thumb { width: 58px; height: 58px; object-fit: cover; border-radius: calc(var(--radius) / 2); cursor: pointer; opacity: .55; transition: opacity .15s, outline .15s; outline: 2px solid transparent; outline-offset: 2px; }
.detail-img-thumb:hover { opacity: .85; }
.detail-img-thumb--active { opacity: 1; outline-color: var(--primary); }
.detail-placeholder { width: 220px; max-width: 100%; height: 280px; background: var(--border); border-radius: var(--radius); display: grid; place-items: center; font-size: 5rem; flex-shrink: 1; }
.detail-header { flex: 1; min-width: 200px; }
.detail-brand { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.detail-header h1 { font-size: 2rem; line-height: 1.2; margin: .25rem 0 .75rem; }
.detail-rating-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.detail-rating { font-size: 1.8rem; }
.detail-accords { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 .5rem; }
.detail-accord-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; width: 80px; min-height: 70px; border-radius: 8px; background: color-mix(in srgb, var(--accord-color) 30%, transparent); border: 1px solid color-mix(in srgb, var(--accord-color) 60%, transparent); padding: .4rem .3rem; text-align: center; }
.detail-accord-emoji { font-size: 1.4rem; line-height: 1; }
.detail-accord-name { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text); line-height: 1.2; word-break: break-word; }
.meta { color: var(--text-muted); font-size: .9rem; margin-top: .3rem; }
.meta-hint { color: var(--text-muted); font-size: .85em; margin-left: .25rem; }
.detail-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.5rem; }
.detail-category { font-size: .8rem; font-weight: bold; text-transform: uppercase; letter-spacing: .07em; color: var(--primary); background: #f5ede6; border-radius: 6px; padding: .2rem .6rem; }
.detail-actions { display: flex; gap: 1rem; margin-top: 2rem; align-items: center; }
.detail-actions form { display: contents; }

.notes-section { margin-bottom: 1.5rem; }
.notes-section--card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; max-width: fit-content; margin-left: auto; margin-right: auto; }
.notes-section h2 { font-size: 1.1rem; color: var(--text-muted); margin-bottom: .75rem; }
.notes-pyramid { display: flex; flex-direction: column; gap: .5rem; }
.note-tier { display: flex; gap: 1rem; align-items: baseline; }
.note-tier-label { width: 70px; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }

.description-section { margin-bottom: 2rem; }
.description-section h2 { font-size: 1.1rem; color: var(--text-muted); margin-bottom: .75rem; }
.description { font-size: 1.05rem; line-height: 1.8; }

.similar-section { margin-top: 3rem; }
.similar-section h2 { font-size: 1.2rem; margin-bottom: 1rem; }

/* ── Assign images page ──────────────────────────────────────────────────── */
.ai-search-panel {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.ai-sel-thumbs { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; flex-wrap: wrap; max-width: 300px; }
.ai-sel-thumb-wrap { position: relative; cursor: pointer; border-radius: 6px; }
.ai-sel-thumb-wrap--primary { cursor: default; }
.ai-sel-thumb-wrap:not(.ai-sel-thumb-wrap--primary):hover .ai-sel-thumb { opacity: .75; border-color: var(--accent); }
.ai-sel-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 2px solid var(--border); display: block; }
.ai-sel-thumb-wrap--primary .ai-sel-thumb { border-color: var(--primary); }
.ai-sel-primary-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--primary);
  color: #fff;
  font-size: .6rem;
  width: 1.1rem; height: 1.1rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.ai-sel-count { font-size: .8rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.ai-search-right { flex: 1; position: relative; }
.ai-search-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}
.ai-search-input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.ai-search-results {
  position: absolute;
  top: calc(100% + .35rem);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  list-style: none;
  margin: 0; padding: .3rem 0;
  box-shadow: var(--shadow);
  z-index: 30;
}
.ai-result {
  padding: .45rem .85rem;
  font-size: .9rem;
  cursor: pointer;
}
.ai-result:hover, .ai-result--focused { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.ai-result-brand { font-size: .75rem; color: var(--text-muted); }
.ai-result-has-img { font-size: .75rem; opacity: .6; }
.ai-search-cancel {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  padding: .25rem .5rem;
  border-radius: 6px;
}
.ai-search-cancel:hover { color: var(--text); background: var(--border); }

.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 320px));
  gap: .75rem;
}
.ai-card {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color .15s, transform .15s, opacity .3s;
  aspect-ratio: 1;
}
.ai-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-card:hover { border-color: var(--border); transform: scale(1.03); }
.ai-card--selected { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.ai-card--removing { opacity: 0; transform: scale(.85); pointer-events: none; }

/* ── Edit page nav ───────────────────────────────────────────────────────── */
.edit-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.edit-nav-title { font-size: 1.5rem; flex: 1; margin: 0; }
.edit-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  flex-shrink: 0;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.edit-nav-arrow:hover { border-color: var(--primary); background: var(--bg); text-decoration: none; }
.edit-nav-arrow--disabled { color: var(--border); cursor: default; }
.edit-nav-back {
  display: flex; align-items: center; gap: .3rem;
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
  text-decoration: none; margin-right: .25rem;
  transition: color .15s;
}
.edit-nav-back:hover { color: var(--primary); text-decoration: none; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.edit-form { max-width: 680px; display: flex; flex-direction: column; gap: 1.25rem; }
.rating-picker { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.rating-btn { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .25rem .5rem; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--text); transition: border-color .15s, background .15s; }
.rating-btn:hover { border-color: var(--primary); }
.rating-btn--active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 15%, transparent); }
.rating-btn--clear { color: var(--text-muted); font-size: .8rem; }.rte-wrap { display: flex; flex-direction: column; gap: 0; }
.rte-toolbar { display: flex; gap: .25rem; padding: .35rem .5rem; background: var(--surface); border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; }
.rte-btn { background: none; border: 1px solid transparent; border-radius: 4px; padding: .15rem .55rem; cursor: pointer; font-size: .95rem; color: var(--text); line-height: 1.4; }
.rte-btn:hover { background: var(--bg); border-color: var(--border); }
.rte-btn--active { background: var(--primary); color: white; border-color: var(--primary); }
.rte-editor { min-height: 10rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); background: var(--bg); color: var(--text); font-size: .95rem; line-height: 1.6; outline: none; }
.rte-editor:focus { border-color: var(--primary); }
.form-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.form-row label { flex: 1; min-width: min(200px, 100%); }
.brand-ac-wrap { position: relative; }
.brand-ac-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.12); list-style: none; margin: 0; padding: .25rem 0; z-index: 200; max-height: 220px; overflow-y: auto; }
.brand-ac-item { padding: .45rem .75rem; cursor: pointer; font-size: .9rem; color: var(--text); }
.brand-ac-item:hover, .brand-ac-item--focused { background: var(--surface-alt, color-mix(in srgb, var(--primary) 8%, var(--surface))); }
.notes-tiers { display: flex; flex-direction: column; gap: 1rem; }
.note-quick-add { padding-top: .5rem; }
.note-quick-add-inner { position: relative; display: flex; gap: .4rem; align-items: center; }
.note-quick-input { flex: 1; font-size: .85rem; padding: .35rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-family: inherit; outline: none; }
.note-quick-input:focus { border-color: var(--primary); }
.note-quick-btn { width: 2rem; height: 2rem; border-radius: 50%; border: none; background: var(--primary); color: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.note-quick-btn:hover { opacity: .85; }
#note-quick-suggestions { position: absolute; top: calc(100% + 4px); left: 0; right: 5rem; }
.chip-tier { display: flex; flex-direction: column; gap: .35rem; }
.chip-tier-label { font-size: .9rem; font-weight: bold; color: var(--text-muted); }
.chip-input-wrap { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-height: 2.6rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: .35rem .5rem; cursor: text; transition: border-color .15s; }
.chip-input-wrap:focus-within { border-color: var(--primary); }
.chip-list { display: contents; }
.chip-tag { display: inline-flex; align-items: center; gap: .25rem; background: color-mix(in srgb, var(--primary) 15%, var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); border-radius: 20px; padding: .15rem .5rem .15rem .6rem; font-size: .8rem; color: var(--text); white-space: nowrap; }
.chip-remove { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: .7rem; padding: 0; line-height: 1; display: flex; align-items: center; }
.chip-remove:hover { color: var(--text); }
.chip-text-input { border: none; outline: none; background: none; font-size: .85rem; color: var(--text); font-family: inherit; min-width: 120px; flex: 1; padding: 0; }
.chip-text-input::placeholder { color: var(--text-muted); }
.chip-suggestions { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.12); list-style: none; margin: 0; padding: .25rem 0; z-index: 300; max-height: 200px; overflow-y: auto; }
.chip-sugg-item { padding: .4rem .75rem; cursor: pointer; font-size: .88rem; color: var(--text); }
.chip-sugg-item:hover, .chip-sugg-item--focused { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.chip-sugg-new { color: var(--primary); font-style: italic; border-top: 1px solid var(--border); margin-top: .25rem; padding-top: .5rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; font-weight: bold; color: var(--text-muted); }
input[type="text"], input[type="number"], input[type="date"], input[type="email"],
input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.hint { font-size: .8rem; font-weight: normal; color: var(--text-muted); }
code { background: var(--border); padding: .1rem .3rem; border-radius: 4px; font-size: .85em; }
.checkbox-label { flex-direction: row; align-items: center; gap: .5rem; font-weight: normal; color: var(--text); }
.checkbox-label input { width: auto; }
.perfume-timestamps { display: flex; gap: 1.5rem; font-size: .82rem; color: var(--text-muted); }
.form-actions { display: flex; gap: 1rem; }
.thumb { width: 120px; border-radius: 8px; margin-bottom: .5rem; }
.edit-gallery { margin-bottom: 1rem; }
.edit-gallery-label { font-size: .85rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: .5rem; }
.edit-gallery-thumbs { display: flex; flex-wrap: wrap; gap: .6rem; }
.edit-gallery-item { position: relative; cursor: grab; }
.edit-gallery-item:active { cursor: grabbing; }
.edit-gallery-item img { width: 90px; height: 90px; object-fit: cover; border-radius: var(--radius); display: block; }
.edit-gallery-item--dragging { opacity: .4; }
.edit-gallery-hint { font-size: .75rem; font-weight: 400; color: var(--text-muted); margin-left: .4rem; }
.edit-gallery-primary-badge { position: absolute; top: .25rem; left: .25rem; background: rgba(0,0,0,.55); color: #fff; font-size: .65rem; border-radius: 4px; padding: .1rem .3rem; pointer-events: none; }
.edit-gallery-remove { position: absolute; top: .25rem; right: .25rem; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 50%; width: 1.3rem; height: 1.3rem; font-size: .7rem; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.edit-gallery-item:hover .edit-gallery-remove { opacity: 1; }

.tag-picker { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.tag-picker-manage-link { font-size: .75rem; font-weight: 400; margin-left: .5rem; color: var(--primary); vertical-align: middle; }
.accord-count-hint { font-size: .75rem; font-weight: normal; color: var(--text-muted); }
.accord-picker-fieldset { gap: .6rem; }
.accord-selected-zone { display: flex; flex-direction: column; gap: .3rem; min-height: 2rem; }
.accord-selected-item { display: flex; align-items: center; gap: .5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .35rem .6rem; cursor: grab; user-select: none; }
.accord-selected-item.accord-dragging { opacity: .4; }
.accord-drag-handle { color: var(--text-muted); cursor: grab; font-size: 1rem; }
.accord-item-label { flex: 1; font-size: .9rem; }
.accord-remove-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: .85rem; padding: 0 .2rem; line-height: 1; }
.accord-remove-btn:hover { color: var(--text); }
.accord-filter-input { font-size: .85rem; padding: .35rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-family: inherit; width: 100%; box-sizing: border-box; outline: none; }
.accord-filter-input:focus { border-color: var(--primary); }
.accord-available-zone { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .4rem; border-top: 1px solid var(--border); }
.accord-available-btn { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: .25rem .65rem; font-size: .82rem; cursor: pointer; color: var(--text); }
.accord-available-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.accord-available-btn:disabled { opacity: .4; cursor: not-allowed; }
.accord-suggest-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.accord-suggest-status { font-size: .82rem; color: var(--text-muted); }
.accord-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.accord-suggestion-chip { border-color: var(--primary) !important; color: var(--primary) !important; }
.accord-suggestion-chip:hover { background: var(--primary) !important; color: #fff !important; }
.tag-group { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.tag-group-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); width: 100%; margin-bottom: -.25rem; }
.tag-check { display: flex; align-items: center; gap: .3rem; font-weight: normal; color: var(--text); flex-direction: row; cursor: pointer; }
.tag-check input { width: auto; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-wrap { max-width: 380px; margin: 3rem auto; }
.login-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.login-remember { display: flex; flex-direction: row; align-items: center; gap: .5rem; font-weight: normal; cursor: pointer; }
.form-error  { color: #b94040; background: #fdf0f0; border: 1px solid #f0c0c0; border-radius: 6px; padding: .6rem 1rem; margin-top: .5rem; }
.form-success { color: #2a7a4a; background: #f0faf4; border: 1px solid #b0dfc0; border-radius: 6px; padding: .6rem 1rem; margin-top: .5rem; }
[data-theme="dark"] .form-error   { background: #3a1a1a; border-color: #7a3030; color: #f09090; }
[data-theme="dark"] .form-success { background: #1a3a28; border-color: #307050; color: #80d0a0; }

/* ── Tags page ───────────────────────────────────────────────────────────── */
.tag-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.5rem; }
.tag-form input, .tag-form select { width: auto; }
.tag-manager { max-width: 680px; margin-top: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.tag-manager summary { font-weight: bold; cursor: pointer; color: var(--text-muted); font-size: .9rem; }
.tag-manager summary:hover { color: var(--primary); }
.tag-manager .tag-form { margin: 1rem 0 .5rem; }
.tag-actions { display: flex; gap: .4rem; }
.tag-table { width: 100%; border-collapse: collapse; }
.tag-table th, .tag-table td { padding: .6rem 1rem; border-bottom: 1px solid var(--border); text-align: left; }
.tag-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }

/* ── Load more ───────────────────────────────────────────────────────────── */
.load-more-wrap { display: flex; justify-content: center; padding: 2rem 0 1rem; }
.load-more-btn { min-width: 140px; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.empty { color: var(--text-muted); font-style: italic; }
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 1.5rem; margin-bottom: 1.5rem; }

/* ── Back to top ─────────────────────────────────────────────────────────── */
.back-to-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg);
  border: none;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  cursor: pointer;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.back-to-top--visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Nav user menu ───────────────────────────────────────────────────────── */
.nav-avatar-btn {
  width: 2.52rem;
  height: 2.52rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, box-shadow .15s;
  flex-shrink: 0;
  text-decoration: none;
}
.nav-avatar-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.nav-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.nav-avatar-emoji { font-size: 1.32rem; line-height: 1; }

/* ── Wearing today widget ────────────────────────────────────────────────── */
.nav-wearing-widget { position: relative; display: flex; align-items: center; }

.nav-wearing-btn {
  display: flex;
  align-items: center;
  gap: .54rem;
  padding: .36rem .78rem .36rem .48rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .98rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  max-width: 288px;
  transition: border-color .15s, box-shadow .15s;
}
.nav-wearing-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.nav-wearing-btn[aria-expanded="true"] { border-color: var(--primary); }

.nav-wearing-btn-thumb {
  width: 2.04rem;
  height: 2.04rem;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  font-size: 1.08rem;
}
.nav-wearing-pill-img { width: 100%; height: 100%; object-fit: cover; }
.nav-wearing-item .nav-wearing-pill-img { width: 2rem; height: 2rem; border-radius: 6px; flex-shrink: 0; }
.nav-wearing-thumb-empty { font-size: 1.08rem; line-height: 1; }

.nav-wearing-btn-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 204px;
  color: var(--text-muted);
}
.nav-wearing-btn-text:not(:empty) { color: var(--text); }
.nav-wearing-caret { flex-shrink: 0; color: var(--text-muted); }

.nav-wearing-dropdown {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  padding: .6rem;
}

.nav-wearing-search {
  width: 100%;
  padding: .38rem .6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: .85rem;
  margin-bottom: .4rem;
}
.nav-wearing-list {
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
}
.nav-wearing-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .38rem .45rem;
  font-size: .82rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background .1s;
}
.nav-wearing-item:hover { background: var(--border); }
.nav-wearing-item--active { background: color-mix(in srgb, var(--primary) 10%, transparent); font-weight: 600; }
.nav-wearing-item--empty { color: var(--text-muted); font-style: italic; cursor: default; }
.nav-wearing-item--empty:hover { background: none; }

.nav-wearing-thumb {
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.nav-wearing-pname { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.nav-wearing-brand { font-size: .7rem; color: var(--text-muted); font-weight: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* ── Profile page ────────────────────────────────────────────────────────── */
/* ── Profile page ────────────────────────────────────────────────────────── */
.profile-page {
  max-width: 860px;
  margin: 0 auto 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Hero: cover + avatar */
.profile-hero { display: flex; flex-direction: column; }
.profile-cover {
  height: 200px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  background-size: cover;
  background-position: center;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
}
.profile-cover--empty { opacity: .7; }
.profile-cover-edit-form { position: absolute; top: .75rem; right: .75rem; }
.profile-cover-edit-btn {
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .8rem; font-size: .8rem; font-weight: 600;
  background: rgba(0,0,0,.45); color: #fff; border-radius: 20px;
  cursor: pointer; backdrop-filter: blur(4px);
  transition: background .15s;
}
.profile-cover-edit-btn:hover { background: rgba(0,0,0,.65); }

.profile-identity-row {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  padding: 0 1.5rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.profile-avatar-wrap {
  position: relative;
  margin-top: -48px;
  flex-shrink: 0;
  cursor: pointer;
}
.profile-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.profile-avatar--placeholder {
  width: 96px; height: 96px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--border);
  font-size: 2.5rem;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.profile-avatar-overlay {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.3rem;
  opacity: 0; transition: opacity .15s;
}
.profile-avatar-wrap:hover .profile-avatar-overlay { opacity: 1; }

.profile-identity { padding-top: .75rem; min-width: 0; }
.profile-name { font-size: 1.45rem; font-weight: 700; margin-bottom: .1rem; }
.profile-username { color: var(--text-muted); font-size: .88rem; margin-bottom: .3rem; }
.profile-bio { font-size: .95rem; color: var(--text); margin-top: .2rem; }
.profile-bio-add summary { cursor: pointer; color: var(--primary); font-size: .9rem; font-weight: 600; list-style: none; }
.profile-bio-add summary::-webkit-details-marker { display: none; }
.profile-bio-form { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.profile-bio-input { width: 100%; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; }

/* Signature + Favourites two-column */
.profile-highlights {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
}
.profile-signature,
.profile-favorites {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.profile-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .85rem;
}
.profile-section-title {
  font-size: .95rem; font-weight: 700; color: var(--primary);
}
.profile-inline-edit summary { list-style: none; cursor: pointer; }
.profile-inline-edit summary::-webkit-details-marker { display: none; }
.profile-edit-btn {
  font-size: .78rem; color: var(--primary); font-weight: 600;
  padding: .2rem .55rem; border: 1px solid var(--primary);
  border-radius: 20px; cursor: pointer;
  transition: background .12s;
}
.profile-edit-btn:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.profile-inline-form { display: flex; flex-direction: column; gap: .4rem; margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--border); }

.profile-sig-card {
  display: flex; flex-direction: column; align-items: center;
  gap: .4rem; text-decoration: none;
}
.profile-sig-card:hover .profile-sig-name { text-decoration: underline; }
.profile-sig-img { width: 100%; max-width: 130px; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.profile-sig-img--empty { background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.profile-sig-brand { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }
.profile-sig-name { font-size: .88rem; font-weight: 600; color: var(--text); text-align: center; }

.profile-fav-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.profile-fav-thumb {
  width: 72px; height: 72px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: border-color .15s;
}
.profile-fav-thumb:hover { border-color: var(--primary); }
.profile-fav-thumb img { width: 100%; height: 100%; object-fit: cover; }
.profile-fav-empty { font-size: 1.6rem; }

/* General sections */
.profile-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.profile-empty { color: var(--text-muted); font-style: italic; font-size: .9rem; }
.profile-daily { display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.profile-daily-img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.profile-daily-name { font-weight: 600; font-size: .92rem; margin-bottom: .25rem; }
.profile-details summary {
  cursor: pointer; font-size: .85rem; color: var(--primary);
  font-weight: 600; padding: .25rem 0; user-select: none;
  list-style: none;
}
.profile-details summary::-webkit-details-marker { display: none; }
.profile-select {
  width: 100%; padding: .4rem .6rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: .88rem;
}
.profile-fav-label { display: flex; align-items: center; gap: .6rem; }
.profile-fav-slot { font-size: .82rem; color: var(--text-muted); min-width: 1.4rem; }
.profile-log { list-style: none; display: flex; flex-direction: column; gap: .4rem; margin-top: .65rem; }
.profile-log-entry { display: flex; align-items: baseline; gap: .75rem; font-size: .9rem; }
.profile-log-date { color: var(--text-muted); font-size: .8rem; min-width: 3.5rem; }
.profile-log-name { color: var(--text); }
.profile-log-name:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .profile-highlights { grid-template-columns: 1fr; }
  .profile-cover { height: 130px; }
  .profile-avatar-wrap { margin-top: -40px; }
  .profile-avatar, .profile-avatar--placeholder { width: 80px; height: 80px; }
  .profile-identity-row { padding: 0 1rem 1rem; gap: .9rem; }
}


