/* ============================================================
   Collectimo Design System
   Tokens → Components → Layouts
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&display=swap');

/* ---- Tokens ------------------------------------------------ */
:root {
  /* Brand */
  --brand:       oklch(54% 0.23 18);
  --brand-dark:  oklch(47% 0.23 18);
  --brand-light: oklch(97% 0.012 18);
  --brand-glow:  oklch(54% 0.23 18 / 0.18);

  /* Surfaces */
  --bg:              oklch(98.5% 0.003 250);
  --surface:         #ffffff;
  --surface-2:       oklch(97% 0.004 250);
  --surface-private: oklch(96.5% 0.01 275);
  --surface-hover:   oklch(96% 0.005 250);

  /* Text */
  --fg:   oklch(15% 0.025 250);
  --fg-2: oklch(42% 0.02  250);
  --fg-3: oklch(62% 0.012 250);

  /* Borders */
  --border:       oklch(91% 0.007 250);
  --border-2:     oklch(83% 0.012 250);
  --border-priv:  oklch(87% 0.015 275);

  /* Semantic */
  --success: oklch(54% 0.18 150);
  --warn:    oklch(68% 0.18 75);
  --danger:  oklch(56% 0.22 25);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow:    0 2px 8px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1),  0 2px 8px rgba(0,0,0,0.06);

  /* Typography */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Nav */
  --nav-w: 220px;

  /* Transitions */
  --tx: 0.15s ease;
}

/* ---- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---- Layout ------------------------------------------------ */
.app {
  display: flex;
  min-height: 100vh;
}

.page-wrap {
  margin-left: var(--nav-w);
  flex: 1;
  padding: 40px 48px 80px;
  max-width: 1360px;
}

/* ---- Nav --------------------------------------------------- */
.nav {
  width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.nav-logo {
  display: block;
  padding: 24px 20px 18px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  color: var(--brand);
  letter-spacing: -0.03em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo span { color: var(--fg); opacity: 0.18; }

.nav-links {
  list-style: none;
  padding: 4px 12px;
  flex: 1;
}

.nav-links li { margin-bottom: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.005em;
  transition: color var(--tx), background var(--tx);
}

.nav-link:hover        { color: var(--fg);    background: var(--surface-2); }
.nav-link.active       { color: var(--brand); background: var(--brand-light); }
.nav-link svg          { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75; }

.nav-divider { height: 1px; background: var(--border); margin: 8px 12px; }

.nav-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-footer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.2;
}

.nav-footer-handle {
  font-size: 12px;
  color: var(--fg-3);
}

/* ---- Avatar ------------------------------------------------ */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}
.avatar-sm  { width: 28px; height: 28px; }
.avatar-md  { width: 36px; height: 36px; }
.avatar-lg  { width: 44px; height: 44px; }
.avatar-xl  { width: 56px; height: 56px; }

/* ---- Typography -------------------------------------------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--fg);
}

h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 20px; letter-spacing: -0.01em; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

.display { font-size: 36px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; }
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-3);
}

/* ---- Breadcrumb -------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-3);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--brand); font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border-2); }

/* ---- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  transition: all var(--tx);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}

.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--brand-glow);
}

.btn-secondary {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border-2);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--fg-3); }

.btn-ghost {
  background: transparent;
  color: var(--fg-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: oklch(49% 0.22 25); }

.btn-sm  { padding: 6px 12px; font-size: 13px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-icon {
  padding: 8px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-2);
  background: var(--surface);
  color: var(--fg-2);
}
.btn-icon:hover { background: var(--surface-2); color: var(--fg); }
.btn-icon svg { width: 18px; height: 18px; }

/* ---- Badges / Tags ----------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-brand   { background: var(--brand-light); color: var(--brand); }
.badge-neutral { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--border); }
.badge-private { background: oklch(92% 0.013 275); color: oklch(40% 0.12 275); border: 1px solid var(--border-priv); }
.badge-success { background: oklch(96% 0.01 150); color: var(--success); }
.badge-count   {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.72);
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ---- Cards ------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.card-p { padding: 24px; }

/* ---- Forms ------------------------------------------------- */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
}

.form-section--private {
  background: var(--surface-private);
  border-color: var(--border-priv);
}

.form-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.form-section-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-section-label svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-row:last-child { margin-bottom: 0; }

.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label,
label.field-label {
  display: block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--fg-2);
  margin-bottom: 5px;
}

.label-required { color: var(--brand); margin-left: 2px; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  transition: border-color var(--tx), box-shadow var(--tx);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder,
textarea::placeholder { color: var(--fg-3); }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%236b7280' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 32px;
  cursor: pointer;
}

textarea { resize: vertical; min-height: 88px; }

/* Toggle */
.toggle-group { display: flex; gap: 24px; }

.toggle-item {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}
.toggle-item input[type="checkbox"] { display: none; }

.toggle-track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-2);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-item input:checked ~ .toggle-track { background: var(--brand); }

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.18s;
}
.toggle-item input:checked ~ .toggle-track::after { transform: translateX(16px); }

.toggle-label-text { font-size: 14px; font-weight: 500; color: var(--fg-2); }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--r);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color var(--tx), background var(--tx);
}
.upload-zone:hover {
  border-color: var(--brand);
  background: var(--brand-light);
}
.upload-zone:hover .upload-icon { color: var(--brand); }
.upload-icon { color: var(--fg-3); display: block; margin: 0 auto 12px; width: 36px; height: 36px; transition: color var(--tx); }
.upload-title { font-size: 14px; font-weight: 700; color: var(--fg-2); margin-bottom: 4px; font-family: var(--font-display); }
.upload-hint  { font-size: 12px; color: var(--fg-3); margin-bottom: 14px; }

.upload-thumbnails { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.upload-thumb {
  width: 60px; height: 60px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-2);
  object-fit: cover;
  background: var(--surface-2);
}

/* Action bar (sticky) */
.action-bar {
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  z-index: 20;
}

/* ---- Item Cards -------------------------------------------- */
.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  position: relative;
  transition: box-shadow var(--tx), transform var(--tx), border-color var(--tx);
  cursor: pointer;
}
.item-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--border-2);
}

.item-card-img-wrap {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}

.item-card-img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.item-card:hover .item-card-img { transform: scale(1.04); }

.item-card-body  { padding: 10px 12px 12px; }
.item-card-kicker { font-size: 11px; font-weight: 700; color: var(--brand); margin-bottom: 2px; letter-spacing: 0.02em; }
.item-card-title { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--fg); line-height: 1.3; margin-bottom: 3px; }
.item-card-meta  { font-size: 12px; color: var(--fg-3); line-height: 1.4; }

.item-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 8px;
  border-top: 1px solid var(--border);
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tx), color var(--tx);
  font-family: var(--font-display);
}
.like-btn:hover  { background: var(--brand-light); color: var(--brand); }
.like-btn svg    { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.like-btn.liked  { color: var(--brand); }
.like-btn.liked svg { fill: var(--brand); }

/* Item grid */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 14px;
}

/* ---- Collection page header -------------------------------- */
.collection-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.collection-header-info h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}

.collection-owner {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--fg-2);
}
.collection-owner a { color: var(--brand); font-weight: 600; }

.collection-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 10px;
}
.collection-stat { font-size: 13px; color: var(--fg-2); }
.collection-stat strong { color: var(--fg); font-family: var(--font-display); font-weight: 800; font-size: 16px; }

.collection-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.search-wrap { position: relative; flex: 1; max-width: 300px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--fg-3); pointer-events: none; stroke: currentColor; fill: none; stroke-width: 2; }
.search-wrap input { padding-left: 32px; }

/* ---- Item Detail ------------------------------------------- */
.item-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.item-gallery-main {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 1;
  position: relative;
}
.item-gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: 24px; }

.item-gallery-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.gallery-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border-2);
  cursor: pointer;
  transition: background var(--tx);
}
.gallery-dot.active { background: var(--brand); }

.item-gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; }
.item-thumb {
  width: 64px; height: 64px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color var(--tx);
  flex-shrink: 0;
}
.item-thumb.active { border-color: var(--brand); }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Item detail info panel */
.item-detail-category { font-size: 13px; color: var(--fg-3); font-weight: 500; margin-bottom: 6px; }
.item-detail-owner    { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--fg-2); margin-bottom: 10px; }
.item-detail-owner a  { color: var(--brand); font-weight: 700; }

.item-detail-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 6px;
}

.item-detail-sub { font-size: 14px; color: var(--fg-2); margin-bottom: 20px; }

.item-actions { display: flex; gap: 8px; margin-bottom: 22px; align-items: center; }

/* Properties table */
.props-table { display: grid; grid-template-columns: auto 1fr; gap: 3px 20px; margin-bottom: 20px; }
.prop-key { font-size: 13px; color: var(--fg-3); font-weight: 500; padding: 4px 0; white-space: nowrap; }
.prop-val { font-size: 13px; color: var(--fg);   font-weight: 600; padding: 4px 0; }

/* Private box */
.private-box {
  background: var(--surface-private);
  border: 1px solid var(--border-priv);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.private-box-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: oklch(42% 0.12 275);
  margin-bottom: 10px;
}
.private-box-head svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Inventory panel */
.inventory-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.inventory-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.inventory-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-3);
}
.inventory-qty {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 10px;
}
.inventory-qty span { font-size: 14px; font-weight: 500; color: var(--fg-3); letter-spacing: 0; }
.inventory-links { display: flex; gap: 12px; }
.inventory-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.inventory-link:hover { text-decoration: underline; }
.inventory-link svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* ---- Series strip ------------------------------------------ */
.series-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.series-item-card {
  border-radius: var(--r);
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--tx);
}
.series-item-card:hover      { box-shadow: var(--shadow-sm); border-color: var(--brand); }
.series-item-card.current    { border-color: var(--brand); }

.series-item-img {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-2);
}
.series-item-img img { width: 100%; height: 100%; object-fit: cover; }

.series-item-label {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  line-height: 1.3;
}
.series-item-card.current .series-item-label { color: var(--brand); }

.series-add-card {
  border-radius: var(--r);
  border: 2px dashed var(--border-2);
  background: var(--surface-2);
  aspect-ratio: auto;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--tx);
  color: var(--fg-3);
  font-size: 13px;
  font-weight: 600;
}
.series-add-card:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }
.series-add-card svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.75; }

/* ---- Comments --------------------------------------------- */
.comments-header { font-family: var(--font-display); font-size: 18px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 20px; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 14px; font-weight: 700; color: var(--fg); }
.comment-time   { font-size: 12px; color: var(--fg-3); }
.comment-text   { font-size: 14px; color: var(--fg-2); line-height: 1.5; }
.comment-reply  { font-size: 12px; font-weight: 700; color: var(--fg-3); margin-top: 6px; cursor: pointer; }
.comment-reply:hover { color: var(--brand); }

.comment-composer {
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 14px;
}
.comment-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.comment-tool-btn {
  padding: 5px;
  border: none;
  background: transparent;
  color: var(--fg-3);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: background var(--tx), color var(--tx);
}
.comment-tool-btn:hover { background: var(--border); color: var(--fg); }

.comment-textarea {
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 12px 14px;
  min-height: 80px;
}
.comment-textarea:focus { box-shadow: none; border: none; }
.comment-submit-bar { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; background: var(--surface-2); }

/* ---- Feed -------------------------------------------------- */
.feed-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

.feed-section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-3);
  margin-bottom: 16px;
}

.feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 14px;
  transition: box-shadow var(--tx);
}
.feed-card:hover { box-shadow: var(--shadow-sm); }

.feed-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
}
.feed-card-source { font-size: 14px; font-weight: 700; color: var(--fg); }
.feed-card-when   { font-size: 12px; color: var(--fg-3); }
.feed-card-tag    { margin-left: auto; }

.feed-card-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  height: 180px;
  overflow: hidden;
}
.feed-card-images img { width: 100%; height: 100%; object-fit: cover; }

.feed-card-body { padding: 12px 16px; }
.feed-card-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--fg); margin-bottom: 2px; }
.feed-card-sub   { font-size: 13px; color: var(--fg-3); }

.feed-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 12px;
}

/* Collection discovery card (feed) */
.collection-discover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.collection-discover-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--tx);
}
.collection-discover-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.collection-discover-images {
  height: 90px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: var(--surface-2);
}
.collection-discover-images img { width: 100%; height: 100%; object-fit: cover; }

.collection-discover-body { padding: 10px 12px 12px; }
.collection-discover-title { font-family: var(--font-display); font-size: 13px; font-weight: 800; color: var(--fg); margin-bottom: 2px; letter-spacing: -0.01em; }
.collection-discover-meta  { font-size: 12px; color: var(--fg-3); margin-bottom: 8px; }

/* Sidebar */
.sidebar-section { margin-bottom: 16px; }
.sidebar-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; color: var(--fg-3); margin-bottom: 10px; }

.sidebar-collection-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--tx);
  margin-bottom: 4px;
}
.sidebar-collection-item:hover { background: var(--surface-2); }

.sidebar-coll-img {
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-coll-img img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-coll-name { font-size: 13px; font-weight: 700; color: var(--fg); line-height: 1.3; margin-bottom: 2px; }
.sidebar-coll-meta { font-size: 12px; color: var(--fg-3); }

.community-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.community-row:last-child { border-bottom: none; }
.community-name   { font-size: 14px; font-weight: 700; color: var(--fg); }
.community-count  { font-size: 12px; color: var(--fg-3); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--fg-3);
}
.empty-state svg { width: 48px; height: 48px; stroke: currentColor; fill: none; stroke-width: 1.5; margin: 0 auto 16px; display: block; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--fg-2); margin-bottom: 6px; }
.empty-state p  { font-size: 14px; }

/* ---- Divider ---------------------------------------------- */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ---- Utility ---------------------------------------------- */
.flex     { display: flex; }
.items-c  { align-items: center; }
.justify-b{ justify-content: space-between; }
.gap-1    { gap: 4px; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.gap-4    { gap: 16px; }
.gap-6    { gap: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.ml-a { margin-left: auto; }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 12px; }
.text-muted{ color: var(--fg-3); }
.text-brand{ color: var(--brand); }
.font-d    { font-family: var(--font-display); }
.font-700  { font-weight: 700; }
.font-800  { font-weight: 800; }
.w-full    { width: 100%; }
.relative  { position: relative; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Collapsible */
.collapse-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.collapse-trigger .chevron {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none; stroke-width: 2.5;
  color: var(--fg-3);
  transition: transform 0.2s;
}
.collapse-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.collapse-body { display: none; }
.collapse-body.open { display: block; margin-top: 16px; }

/* Section heading helper */
.section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ============================================================
   Mobile header + nav overlay
   ============================================================ */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  box-shadow: var(--shadow-xs);
}

.mobile-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: var(--brand);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.mobile-hamburger {
  width: 44px; height: 44px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--r-sm);
  transition: background var(--tx);
  flex-shrink: 0;
}
.mobile-hamburger:hover { background: var(--surface-2); }
.mobile-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: all 0.2s;
}
.mobile-hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-hamburger.active span:nth-child(2) { opacity: 0; }
.mobile-hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.nav-backdrop.visible { display: block; }

/* ============================================================
   Tablet (≤ 900px) — collapse side-by-side layouts
   ============================================================ */
@media (max-width: 900px) {
  .page-wrap {
    padding: 28px 28px 60px;
  }

  /* Feed: hide sidebar, go single column */
  .feed-layout {
    grid-template-columns: 1fr;
  }
  .feed-sidebar {
    display: none;
  }

  /* Item detail: stack gallery + info */
  .item-detail-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  /* Collection header: allow wrapping */
  .collection-header {
    flex-wrap: wrap;
    gap: 14px;
  }
  .collection-header-info h1 {
    font-size: clamp(20px, 4vw, 30px);
  }

  /* Add item: collapse two-column layout */
  .add-item-layout {
    grid-template-columns: 1fr;
  }
  .photos-column {
    position: static;
    order: -1;
  }

  /* 3-col form rows → 2-col */
  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   Mobile (≤ 640px) — full mobile treatment
   ============================================================ */
@media (max-width: 640px) {
  /* Nav becomes overlay drawer */
  .nav {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
    top: 0;
  }
  .nav.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }

  /* Show mobile header */
  .mobile-header { display: flex; }

  /* Push content below the fixed mobile header */
  .app {
    padding-top: 56px;
  }

  /* Remove the left margin that accommodated the sidebar */
  .page-wrap {
    margin-left: 0;
    padding: 20px 16px 80px;
  }

  /* Typography */
  h1 { font-size: 22px; }
  .item-detail-title { font-size: 24px !important; }
  .collection-header-info h1 { font-size: 22px; }
  .display { font-size: clamp(24px, 7vw, 36px); }

  /* Form grids → single column */
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  /* Item grid — 2 columns on phone */
  .items-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Series strip */
  .series-strip {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  /* Toolbar — wrap search to full width */
  .toolbar { flex-wrap: wrap; }
  .search-wrap { max-width: 100%; flex: 1 1 100%; order: -1; }

  /* Collection header */
  .collection-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .collection-actions { flex-wrap: wrap; gap: 6px; }

  /* Collection discover grid → single column */
  .collection-discover-grid {
    grid-template-columns: 1fr;
  }

  /* Feed */
  .feed-card-images { height: 130px; }
  .feed-sidebar { display: none; }

  /* Sticky action bar → stacked */
  .action-bar {
    padding: 12px 16px;
    flex-direction: column-reverse;
    gap: 8px;
    align-items: stretch;
  }
  .action-bar .btn {
    width: 100%;
    justify-content: center;
  }

  /* Props table — prevent overflow */
  .props-table {
    grid-template-columns: 120px 1fr;
  }

  /* Item gallery thumbs — horizontal scroll */
  .item-gallery-thumbs {
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: nowrap;
  }

  /* Comments composer */
  .comment-toolbar {
    flex-wrap: wrap;
    gap: 2px;
  }

  /* Button sizes on small screens */
  .btn-lg {
    padding: 11px 20px;
    font-size: 14px;
  }
}
