/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  /* Core palette */
  --gold:          #C9A84C;
  --gold-light:    #F5E6B2;
  --gold-dark:     #8B6914;
  --rose-gold:     #C4788A;
  --rose-light:    #F7E1E5;
  --rose-dark:     #8B3D50;
  --champagne:     #E8D5B7;
  --blush:         #F0CDD3;
  --wine:          #6B2D3E;
  --pearl:         #F2EDE6;
  --cream:         #F8F3EE;

  /* UI */
  --bg:            #F2EDE6;
  --sidebar-bg:    #14213D;
  --sidebar-w:     248px;
  --card-bg:       #FDFAF7;
  --border:        #E8E0D6;
  --border-soft:   #EEE8DF;
  --text:          #2A1A12;
  --text-muted:    #8B6E60;
  --text-light:    #BEA898;
  --danger:        #C0392B;
  --success:       #27AE60;
  --radius:        14px;
  --radius-lg:     20px;
  --shadow-sm:     0 1px 4px rgba(139,73,48,0.07);
  --shadow:        0 4px 16px rgba(139,73,48,0.10);
  --shadow-lg:     0 8px 32px rgba(139,73,48,0.14);
  --transition:    0.22s ease;
  --topbar-h:      62px;
  --bottom-nav-h:  64px;
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
  --safe-top:      env(safe-area-inset-top, 0px);
  /* Jeweller's display-case backdrop behind whole (uncropped) photos:
     royal navy velvet with a warm gold sheen (top-left) and a faint gold glow. */
  --display-bg:
    radial-gradient(ellipse 60% 45% at 28% 16%, rgba(255, 220, 160, 0.42), rgba(255, 210, 140, 0.10) 45%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 78% 88%, rgba(255, 200, 120, 0.14), transparent 70%),
    radial-gradient(ellipse 95% 85% at 50% 50%, #2f56b8 0%, #1d3a8a 45%, #10225a 80%, #0a173f 100%);
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  overscroll-behavior: none;
  overflow-x: hidden;
}
/* Let .main (lone in-flow flex item; sidebar is position:fixed) shrink to the
   viewport instead of being forced wider by intrinsic content width. This is a
   safe, layout-neutral guard against mobile horizontal overflow. */
.main { min-width: 0; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-family: inherit; font-size: 16px; outline: none; }
input:focus, select:focus, textarea:focus {
  border-color: var(--rose-gold) !important;
  box-shadow: 0 0 0 3px rgba(196,120,138,0.12);
}
img { display: block; max-width: 100%; }

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.sidebar {
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  padding-top: var(--safe-top);
  background:
    radial-gradient(ellipse at 18% 12%, rgba(80,130,220,0.22) 0%, transparent 50%),
    radial-gradient(ellipse at 82% 78%, rgba(150,80,230,0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 55% 45%, rgba(20,120,100,0.10) 0%, transparent 55%),
    linear-gradient(168deg, #162448 0%, #281155 45%, #0E2540 100%);
}
.sidebar-header {
  padding: 24px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(80,130,220,0.18);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 30px; height: 30px; border-radius: 8px; display: block; box-shadow: 0 2px 6px rgba(11, 26, 71, 0.35); }
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #C9A84C, #E8D5B7, #C4788A);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.3px;
}
.sidebar-close { background: none; border: none; color: #8BA8D0; font-size: 16px; padding: 6px; border-radius: 6px; display: none; }
.sidebar-close:hover { color: #fff; }
.sidebar-nav { padding: 16px 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px;
  color: #8BA8D0;
  transition: all var(--transition);
  border-left: 2px solid transparent;
  white-space: nowrap;
  min-height: 48px;
  font-size: 13.5px;
  letter-spacing: 0.1px;
}
.nav-item:hover { background: rgba(80,130,220,0.12); color: #C8D8F4; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(80,130,220,0.18), rgba(150,80,230,0.08), transparent);
  color: var(--gold);
  border-left-color: var(--gold);
  font-weight: 500;
}
.nav-icon { font-size: 17px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(80,130,220,0.15);
  font-size: 11px;
  color: rgba(160,190,240,0.3);
  text-align: center;
  font-family: 'Playfair Display', serif;
  letter-spacing: 1px;
}

/* ─── Main ───────────────────────────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  background: rgba(242,237,230,0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 28px;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  padding-top: var(--safe-top);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.hamburger {
  display: none;
  background: none; border: none; font-size: 20px; padding: 8px;
  min-width: 44px; min-height: 44px; border-radius: 8px;
  align-items: center; justify-content: center; color: var(--text);
}
.hamburger:active { background: var(--border); }
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 21px; font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
}
.search-box { position: relative; display: flex; align-items: center; }
.search-box input {
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 8px 36px 8px 16px;
  width: 230px;
  background: var(--cream);
  color: var(--text);
  font-size: 13px;
}
.search-icon { position: absolute; right: 12px; pointer-events: none; font-size: 13px; }

/* ─── Pages ──────────────────────────────────────────────────────────────────── */
.page { display: none; padding: 0; animation: fadeIn 0.25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Non-dashboard pages keep standard padding */
#page-collection, #page-add, #page-categories {
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* ═══════════════════════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Hero Banner ────────────────────────────────────────────────────────────── */
.dash-hero {
  position: relative;
  overflow: hidden;
  padding: 40px 32px 36px;
  background:
    linear-gradient(135deg, #1A0A12 0%, #2D1420 40%, #1A0D20 70%, #0F0A05 100%);
  min-height: 180px;
  display: flex;
  align-items: center;
}
.dash-hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  pointer-events: none;
  animation: orbFloat 6s ease-in-out infinite;
}
.dash-hero-orb1 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(201,168,76,0.35) 0%, transparent 70%);
  top: -80px; left: -40px;
  animation-delay: 0s;
}
.dash-hero-orb2 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(196,120,138,0.3) 0%, transparent 70%);
  bottom: -60px; right: 20%;
  animation-delay: 2s;
}
.dash-hero-orb3 {
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(232,213,183,0.2) 0%, transparent 70%);
  top: 20px; right: 10%;
  animation-delay: 4s;
}
@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-12px) scale(1.05); }
}
.dash-hero-content { position: relative; z-index: 2; }
.dash-hero-eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  font-weight: 500;
}
.dash-hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(135deg, #F5E6B2 0%, #E8D5B7 40%, #F7E1E5 80%, #E8B4B8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.dash-hero-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.45);
  font-style: italic;
  letter-spacing: 0.3px;
}
.dash-hero-gems {
  position: absolute;
  right: 40px; top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex; flex-direction: column; gap: 4px;
  align-items: flex-end;
}
.gem-float {
  font-size: 28px;
  display: block;
  animation: gemFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(201,168,76,0.6));
}
.gem-float.g1 { animation-delay: 0s; font-size: 32px; }
.gem-float.g2 { animation-delay: 1.3s; font-size: 24px; opacity: 0.8; }
.gem-float.g3 { animation-delay: 2.6s; font-size: 20px; opacity: 0.6; }
@keyframes gemFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}

/* ─── Stat Cards ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding: 24px 28px 0;
}
.stat-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  overflow: hidden;
  cursor: default;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid transparent;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card-link { cursor: pointer; }
.stat-card-bg {
  position: absolute; inset: 0;
  border-radius: inherit;
  z-index: 0;
}
.stat-card.s-gold { background: linear-gradient(145deg, #3D2A08, #5A3C0A); border-color: rgba(201,168,76,0.3); }
.stat-card.s-gold .stat-card-bg { background: radial-gradient(ellipse at top left, rgba(201,168,76,0.2), transparent 65%); }
.stat-card.s-rose { background: linear-gradient(145deg, #3A1020, #5C1E34); border-color: rgba(196,120,138,0.3); }
.stat-card.s-rose .stat-card-bg { background: radial-gradient(ellipse at top left, rgba(196,120,138,0.2), transparent 65%); }
.stat-card.s-blush { background: linear-gradient(145deg, #2D1A22, #4A2535); border-color: rgba(240,205,211,0.2); }
.stat-card.s-blush .stat-card-bg { background: radial-gradient(ellipse at top left, rgba(240,205,211,0.15), transparent 65%); }
.stat-card.s-pearl { background: linear-gradient(145deg, #1E1810, #352C1A); border-color: rgba(232,213,183,0.2); }
.stat-card.s-amber { background: linear-gradient(145deg, #3B2604, #6B4410); border-color: rgba(232,170,60,0.3); }
.stat-card.s-amber .stat-card-bg { background: radial-gradient(ellipse at top left, rgba(232,170,60,0.22), transparent 65%); }
.stat-card.s-pearl .stat-card-bg { background: radial-gradient(ellipse at top left, rgba(232,213,183,0.15), transparent 65%); }
.stat-card-icon {
  position: relative; z-index: 1;
  font-size: 26px;
  margin-bottom: 14px;
  display: block;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.15));
}
.stat-card-body { position: relative; z-index: 1; }
.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 5px;
  letter-spacing: -0.3px;
}
.stat-card.s-gold .stat-value { color: #F5E6B2; }
.stat-card.s-rose .stat-value { color: #F7D9DF; }
.stat-card.s-blush .stat-value { color: #F0CDD3; }
.stat-card.s-pearl .stat-value { color: #E8D5B7; }
.stat-card.s-amber .stat-value { color: #F8DFA6; }
.stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}
.stat-card-deco {
  position: absolute;
  bottom: 12px; right: 16px;
  font-size: 20px;
  color: rgba(255,255,255,0.06);
  z-index: 0;
  font-family: serif;
}

/* ─── Recently Added ─────────────────────────────────────────────────────────── */
.dash-section { padding: 32px 28px 8px; }
.dash-section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.dash-section-title-wrap {
  display: flex; align-items: center; gap: 14px;
  min-width: 0;
}
.dash-section-header .dash-view-all { white-space: nowrap; flex-shrink: 0; }
.dash-section-rule {
  flex: 0 0 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.dash-section-rule:last-child {
  background: linear-gradient(90deg, var(--gold), transparent);
}
.dash-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.dash-view-all {
  font-size: 12px;
  color: var(--rose-gold);
  font-weight: 500;
  letter-spacing: 0.4px;
  transition: color var(--transition);
}
.dash-view-all:hover { color: var(--rose-dark); }

.recent-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.recent-card {
  min-width: 0;   /* let one-line text truncate instead of widening the grid column */
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}
.recent-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.recent-card:active { transform: scale(0.97); }
.recent-card-img {
  position: relative;
  height: 100px;
  background: linear-gradient(135deg, #F7E1E5, #F5E6B2, #E8D5B7);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  overflow: hidden;
}
.recent-card-img img { width: 100%; height: 100%; object-fit: contain; background: var(--display-bg); }  /* whole photo, not cropped */
.recent-card-body { padding: 10px 12px; }
.recent-card-name { font-weight: 600; font-size: 12px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.recent-card-meta { font-size: 10px; color: var(--text-muted); }
.recent-card-value { font-size: 12px; font-weight: 700; margin-top: 4px; color: var(--rose-dark); }
.recent-card-hint { font-size: 10px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Heading that doubles as the dashboard strip's sort choice */
.dash-sort-select {
  font: inherit; color: inherit; background: transparent; border: none; cursor: pointer;
  padding: 2px 22px 2px 4px; border-radius: 8px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold-dark) 50%), linear-gradient(135deg, var(--gold-dark) 50%, transparent 50%);
  background-position: calc(100% - 10px) 55%, calc(100% - 5px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.dash-sort-select:hover, .dash-sort-select:focus-visible { background-color: var(--cream); outline: none; }
.dash-sort-select option { font-family: 'Inter', sans-serif; font-size: 14px; }

/* ─── Portfolio Comparison ────────────────────────────────────────────────────── */
#portfolio-row { padding: 0 28px 4px; }
.portfolio-compare {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 22px 14px;
  box-shadow: var(--shadow-sm);
}
.portfolio-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.portfolio-compare-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.portfolio-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.dot-gold  { background: linear-gradient(135deg, var(--gold), var(--rose-gold)); }
.dot-muted { background: var(--border); }
.portfolio-compare-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.portfolio-compare-val   { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; color: var(--text); }
.portfolio-gain {
  text-align: center;
  padding: 6px 14px;
  border-radius: 24px;
  flex-shrink: 0;
}
.portfolio-gain.gain { background: rgba(76, 175, 80, 0.10); border: 1px solid rgba(76, 175, 80, 0.25); }
.portfolio-gain.loss { background: rgba(239, 83, 80, 0.10); border: 1px solid rgba(239, 83, 80, 0.25); }
.portfolio-gain-badge { font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 700; }
.portfolio-gain.gain .portfolio-gain-badge { color: #3d9a40; }
.portfolio-gain.loss .portfolio-gain-badge { color: #d9534f; }
.portfolio-gain-pct { font-size: 11px; font-weight: 600; margin-top: 2px; }
.portfolio-gain.gain .portfolio-gain-pct { color: #5cb85c; }
.portfolio-gain.loss .portfolio-gain-pct { color: #e57373; }
.portfolio-bars { display: flex; flex-direction: column; gap: 6px; }
.portfolio-bar-track { height: 6px; background: var(--border-soft); border-radius: 3px; overflow: hidden; }
.portfolio-bar-fill { height: 100%; border-radius: 3px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.bar-gold  { background: linear-gradient(90deg, var(--rose-gold), var(--gold)); }
.bar-muted { background: var(--border); }

/* ─── Charts ─────────────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px 28px 28px;
}
.dash-chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 22px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.dash-chart-card:hover { box-shadow: var(--shadow); }
.dash-chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 8px;
}
.dash-chart-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.dash-chart-icon { font-size: 16px; }
.chart-toggles { display: flex; gap: 4px; }
.chart-toggle {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.chart-toggle.active, .chart-toggle:hover {
  background: linear-gradient(135deg, var(--rose-gold), var(--gold));
  border-color: transparent;
  color: white;
}
.chart-empty { color: var(--text-muted); font-size: 13px; padding: 16px 0; }

/* Donut Chart */
.donut-wrap {
  position: relative;
  width: 160px; height: 160px;
  margin: 0 auto 16px;
}
.donut-svg { width: 100%; height: 100%; }
.donut-seg { transition: stroke-dasharray 0.7s cubic-bezier(0.4,0,0.2,1); }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.donut-center-val {
  font-family: 'Playfair Display', serif;
  font-size: 15px; font-weight: 700;
  color: var(--text); line-height: 1.2;
}
.donut-center-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.donut-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; }
.donut-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.donut-legend-item.donut-key-active { background: var(--border-soft); }
.donut-legend-item.donut-key-active .donut-legend-label { color: var(--text); font-weight: 600; }
.donut-seg { cursor: pointer; transition: opacity 0.2s, stroke-dasharray 0.7s cubic-bezier(0.4,0,0.2,1); }
.donut-seg.donut-dim { opacity: 0.25; }
.donut-center { pointer-events: none; }   /* overlays the ring: let hover/tap reach the slices */
.donut-center-sub { max-width: 90px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.donut-legend-label { color: var(--text-muted); white-space: nowrap; }
.donut-legend-val { font-weight: 600; color: var(--text); white-space: nowrap; }

/* Top Pieces */
.top-pieces-list { display: flex; flex-direction: column; gap: 10px; padding: 0 0 4px; }
/* Top pieces as share of collection value */
.tp-card { background: var(--card-bg); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: 18px 18px 14px; box-shadow: var(--shadow-sm); }
.tp-headline { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; }
.tp-headline strong { font-family: 'Playfair Display', serif; font-size: 20px; color: var(--text); }
.tp-bar { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--card-bg); }
.tp-seg { min-width: 4px; transition: opacity 0.2s, transform 0.2s; cursor: default; }
.tp-seg-rest { background: var(--border); }
.tp-bar:hover .tp-seg:not(.tp-hl) { opacity: 0.45; }
.tp-bar-key { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-size: 12px; color: var(--text-muted); margin: 6px 0 14px; }
.tp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.tp-dot-rest { background: var(--border); }
.tp-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.tp-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; transition: background 0.2s, border-color 0.2s; min-width: 0; }
.tp-row:hover, .tp-row.tp-hl { background: var(--bg); border-color: var(--border-soft); }
.tp-rank { font-family: 'Playfair Display', serif; font-size: 14px; font-weight: 700; color: var(--text-muted); white-space: nowrap; width: 46px; flex-shrink: 0; }
.tp-row .top-piece-img { width: 42px; height: 42px; }
.tp-info { flex: 1; min-width: 0; }
.tp-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-num { text-align: right; flex-shrink: 0; }
.tp-val { font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; }
.tp-pct { display: inline-block; font-size: 10.5px; font-weight: 600; color: var(--gold-dark); background: rgba(201, 168, 76, 0.14); border-radius: 20px; padding: 1px 7px; margin-top: 2px; white-space: nowrap; }
@media (max-width: 899px) { .tp-rows { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .tp-card { padding: 14px 12px 10px; }
  .tp-row { gap: 9px; padding: 7px 6px; }
  .tp-rank { width: 30px; font-size: 13px; }
  .tp-rank .tp-dot { margin-right: 4px; }
  .tp-row .top-piece-img { width: 36px; height: 36px; }
  .tp-pct-long { display: none; }
}
.top-piece-img {
  width: 48px; height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.top-piece-img img { width: 100%; height: 100%; object-fit: cover; }
.top-piece-name { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* legacy bar chart (kept for potential reuse) */
.bar-chart { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 82px; font-size: 12px; color: var(--text-muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 8px; background: var(--border-soft); border-radius: 4px; overflow: hidden; }
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rose-gold), var(--gold));
  border-radius: 4px;
  transition: width 0.7s cubic-bezier(0.4,0,0.2,1);
}
.bar-count { width: 28px; font-size: 12px; color: var(--text-muted); font-weight: 600; text-align: right; }

/* ═══════════════════════════════════════════════════════════════════════════════
   SHARED CARDS & COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title-row .card-title { margin-bottom: 0; }
.link-btn { font-size: 13px; color: var(--rose-gold); font-weight: 500; }
.link-btn:hover { color: var(--rose-dark); }
.full-width { grid-column: 1 / -1; }

/* ─── Filter Bar ─────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex: 1; padding-bottom: 2px; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-select {
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 9px 14px;
  background: var(--card-bg);
  color: var(--text);
  white-space: nowrap;
  min-height: 44px;
  font-size: 13px;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--rose-gold) !important; box-shadow: 0 0 0 3px rgba(196,120,138,0.10); }
.add-fab-desktop { white-space: nowrap; }

/* ─── Items Grid ─────────────────────────────────────────────────────────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.item-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.item-card:active { transform: scale(0.98); }
.item-card-img {
  height: 150px;
  background: linear-gradient(135deg, var(--rose-light), var(--gold-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  position: relative; overflow: hidden;
}
.item-card-img img { width: 100%; height: 100%; object-fit: contain; background: var(--display-bg); }  /* whole photo, not cropped */
/* Placeholder artwork (jewel-art.js / coin picture) for pieces without a photo.
   Small lists: an icon sized by the surrounding font-size. Large spots (cards,
   item detail): fills the area on the velvet display backdrop. */
.jewel-art-wrap { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.jewel-art-wrap .jewel-art, .jewel-art-wrap .coin-art { width: 1.6em; height: 1.6em; background: none; }
.jewel-art { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)); }
.coin-art { display: inline-block; filter: drop-shadow(0 2px 4px rgba(122, 82, 6, 0.35)); }
.item-card-img > .jewel-art-wrap, .recent-card-img > .jewel-art-wrap, .detail-img-placeholder > .jewel-art-wrap {
  position: absolute; inset: 0; background: var(--display-bg);
}
.item-card-img > .jewel-art-wrap > *, .recent-card-img > .jewel-art-wrap > *, .detail-img-placeholder > .jewel-art-wrap > * {
  width: 72%; height: 72%; object-fit: contain;
}
/* Drawings leave margin inside their frame, so draw them larger than the coin */
.item-card-img > .jewel-art-wrap > .jewel-art, .recent-card-img > .jewel-art-wrap > .jewel-art,
.detail-img-placeholder > .jewel-art-wrap > .jewel-art { width: 92%; height: 92%; }
/* Material tag; gold materials: gold text on maroon */
.material-tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 0.92em; line-height: 1.5; background: var(--border-soft); color: var(--text); }
.material-tag-gold, .item-card-badge.badge-gold {
  background: linear-gradient(135deg, #7A1F33, #5A1224); color: #F3C969;
  border: 1px solid rgba(243, 201, 105, 0.55); font-weight: 600; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.item-card-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(15,10,5,0.65);
  color: var(--champagne);
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.item-card-body { padding: 12px 14px; }
.item-card-name { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.item-card-cat { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.item-card-hint { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 6px; }
.item-card-hint.hint-gain { color: #1E7B45; }   /* darker than --success: readable at 12px */
.item-card-hint.hint-loss { color: var(--danger); }
.item-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px;
  background: var(--pearl);
  border-top: 1px solid var(--border-soft);
}
.item-card-value { font-size: 14px; font-weight: 700; color: var(--rose-dark); }
.item-card-actions { display: flex; gap: 2px; }
.icon-btn {
  background: none; border: none; font-size: 14px;
  min-width: 36px; min-height: 36px; padding: 4px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover, .icon-btn:active { background: var(--border); }
.empty-state { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 52px; margin-bottom: 12px; }

/* ─── Item Form ──────────────────────────────────────────────────────────────── */
.item-form { max-width: 960px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.form-section:last-child { margin-bottom: 0; }
.form-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--rose-dark);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.form-section-optional { font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); margin: -4px 0 12px; line-height: 1.4; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--cream);
  color: var(--text);
  transition: border-color var(--transition);
  min-height: 44px;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.insurance-row { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 14px; color: var(--text);
  min-height: 44px;
}
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; min-height: unset; accent-color: var(--rose-gold); }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; padding-top: 8px; margin-top: 4px; }

/* Image Upload */
.image-upload-area { position: relative; }
.image-upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.image-preview {
  border: 2px dashed var(--border);
  border-radius: 10px;
  height: 130px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream);
  transition: border-color var(--transition);
  overflow: hidden;
}
.image-upload-area:hover .image-preview { border-color: var(--rose-gold); }
.image-preview img { width: 100%; height: 100%; object-fit: contain; background: var(--display-bg); }
.upload-placeholder { color: var(--text-muted); font-size: 13px; pointer-events: none; }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.2px;
}
.btn-primary { background: linear-gradient(135deg, var(--rose-gold), var(--rose-dark)); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #B8657A, #6B2D3E); box-shadow: 0 4px 12px rgba(196,120,138,0.35); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: var(--cream); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: #FDE8E6; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; min-height: 36px; }

/* ─── Insurance Panel ────────────────────────────────────────────────────────── */
.insurance-panel {
  background: linear-gradient(135deg, #FDF0F4, #FDF9F4);
  border: 1px solid rgba(196,120,138,0.2);
  border-radius: 10px;
  padding: 14px;
  margin-top: 6px;
}
.inline-doc-upload { }
.inline-doc-actions { display: flex; gap: 8px; margin-bottom: 10px; }

/* ─── Categories Page ────────────────────────────────────────────────────────── */
.add-category-form { display: flex; gap: 8px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border-soft); margin-bottom: 8px; flex-wrap: wrap; }
.add-category-form input { border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 12px; flex: 1; min-width: 160px; min-height: 44px; }
.categories-list { display: flex; flex-direction: column; gap: 6px; }
.category-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 8px; background: var(--cream); border: 1px solid var(--border-soft); min-height: 48px; }
.category-item-name { font-weight: 500; }
.category-item-count { font-size: 12px; color: var(--text-muted); }

/* ─── Brands list ────────────────────────────────────────────────────────────── */
.brands-list { display: flex; flex-direction: column; gap: 8px; }
.brand-item { padding: 14px 16px; border-radius: 10px; background: var(--cream); border: 1px solid var(--border-soft); }
.brand-item-main { flex: 1; }
.brand-item-name { font-weight: 600; font-size: 15px; display: block; margin-bottom: 6px; }
.brand-policy-row { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.policy-label { font-weight: 600; color: var(--gold-dark); white-space: nowrap; min-width: 60px; }
.policy-text { color: var(--text-muted); }
.policy-empty { color: var(--text-light); font-style: italic; }
.brand-item-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.policy-group-title { font-size: 13px; font-weight: 600; color: var(--gold-dark); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-soft); }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,5,0,0.6);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--card-bg);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.modal-close {
  position: sticky; top: 12px; float: right; margin: 12px 14px 0 0;
  background: var(--cream); border: none; font-size: 15px;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.modal-close:hover { background: var(--border); }
/* Whole photo visible (contain, never cropped) on a soft background. */
.detail-img-wrap { width: 100%; height: 250px; background: var(--display-bg); }
.detail-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.detail-img-placeholder {
  position: relative; overflow: hidden;
  width: 100%; height: 250px;
  background: linear-gradient(135deg, var(--rose-light), var(--gold-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 72px;
}
.detail-body { padding: 22px; padding-bottom: calc(22px + var(--safe-bottom)); }
.detail-title { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; }
.detail-category { font-size: 13px; color: var(--text-muted); margin: 4px 0 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.detail-field-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.detail-field-value { font-size: 14px; font-weight: 500; }
.detail-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.detail-actions .btn { flex: 1; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-excellent { background: #D5F5E3; color: #1E8449; }
.badge-good      { background: #D6EAF8; color: #1A5276; }
.badge-fair      { background: #FEF9E7; color: #7D6608; }
.badge-repair    { background: #FDECEA; color: var(--danger); }

/* Value history */
.value-history { margin-top: 14px; }
.value-history-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.4px; }
.history-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.history-row:last-child { border-bottom: none; }

/* ─── Documents & Scans ─────────────────────────────────────────────────────── */
.doc-upload-section { margin-top: 16px; }
.doc-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.doc-group { border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.doc-group:last-child { margin-bottom: 0; }
.doc-group-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--cream); border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.doc-group-icon { font-size: 18px; }
.doc-group-title { font-weight: 600; font-size: 14px; flex: 1; }
.doc-group-actions { display: flex; gap: 8px; }
.btn-scan   { background: #EEF6FF; color: #1A5276; border: 1px solid #AED6F1; }
.btn-upload { background: #F4FCF5; color: #1E8449; border: 1px solid #A9DFBF; }
.btn-scan:active, .btn-upload:active { filter: brightness(0.92); }
.doc-preview-list { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; min-height: 56px; }
.doc-preview-list:empty::after { content: 'No files yet'; color: var(--text-muted); font-size: 12px; align-self: center; }
.doc-thumb { position: relative; width: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--cream); cursor: pointer; transition: transform var(--transition); flex-shrink: 0; }
.doc-thumb:active { transform: scale(0.96); }
.doc-thumb-img { width: 80px; height: 80px; object-fit: cover; display: block; }
.doc-thumb-pdf { width: 80px; height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #FFF5F5; gap: 4px; }
.doc-thumb-pdf-icon { font-size: 28px; }
.doc-thumb-pdf-label { font-size: 9px; font-weight: 700; color: var(--danger); text-transform: uppercase; letter-spacing: 0.5px; }
.doc-thumb-name { font-size: 10px; color: var(--text-muted); padding: 4px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px; display: block; }
.doc-thumb-del { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,0.55); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.doc-set-cover { display: block; width: 100%; border: none; border-top: 1px solid var(--border); background: var(--gold-soft, #FBF3E0); color: var(--gold-dark); font-size: 9px; font-weight: 700; padding: 4px 2px; cursor: pointer; -webkit-tap-highlight-color: transparent; letter-spacing: 0.3px; }
.doc-set-cover:active { background: var(--gold); color: #fff; }
.doc-thumb-del:hover { background: var(--danger); }
.doc-thumb-uploading .doc-thumb-img, .doc-thumb-uploading .doc-thumb-pdf { opacity: 0.4; }
.doc-thumb-progress { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.6); font-size: 11px; font-weight: 600; color: var(--rose-dark); }
.modal-docs-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.modal-docs-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 12px; }
.modal-doc-group { margin-bottom: 14px; }
.modal-doc-group-label { font-size: 12px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.modal-doc-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }

/* ─── Document Viewer Modal ──────────────────────────────────────────────────── */
.doc-viewer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 300; display: flex; flex-direction: column; align-items: stretch; padding: 0; }
.doc-viewer-modal { display: flex; flex-direction: column; width: 100%; height: 100%; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
.doc-viewer-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: rgba(0,0,0,0.7); gap: 10px; flex-shrink: 0; }
.doc-viewer-name { color: #fff; font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-viewer-actions { display: flex; gap: 8px; align-items: center; }
.doc-viewer-close { background: rgba(255,255,255,0.15); border: none; color: #fff; font-size: 16px; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.doc-viewer-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; -webkit-overflow-scrolling: touch; }
.doc-viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.doc-viewer-body iframe { width: 100%; height: 100%; border: none; }

/* ─── Bottom Nav ─────────────────────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  background: rgba(242,237,230,0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-soft);
  z-index: 80;
  padding-bottom: var(--safe-bottom);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; color: var(--text-muted);
  min-height: 44px; padding: 6px 4px;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active { color: var(--rose-gold); }
.bottom-nav-item:active { background: rgba(196,120,138,0.06); }
.bottom-nav-icon { font-size: 20px; line-height: 1; }
.bottom-nav-label { font-size: 10px; font-weight: 500; }
.bottom-nav-add {
  background: linear-gradient(135deg, var(--rose-gold), var(--rose-dark));
  color: #fff !important;
  border-radius: 16px;
  margin: 6px 8px;
  flex: none;
  width: 56px; height: 48px;
  padding: 0;
  box-shadow: 0 4px 12px rgba(196,120,138,0.4);
}
.bottom-nav-add .bottom-nav-label { display: none; }
.bottom-nav-add .bottom-nav-icon { font-size: 22px; }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  left: 50%; transform: translateX(-50%);
  background: var(--text);
  color: #fff; padding: 12px 22px; border-radius: 8px;
  font-size: 13px; font-weight: 500; z-index: 1000;
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none; white-space: nowrap;
  max-width: calc(100vw - 40px); text-align: center;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ─── Loading ────────────────────────────────────────────────────────────────── */
.loading-spinner { grid-column: 1/-1; text-align: center; padding: 40px; color: var(--text-muted); }

/* ── Gold Rate & Value Trend ─────────────────────────────────────────────────── */
.gold-rate-card { padding: 20px; }
.gold-rate-input-row {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
}
.gr-field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 130px; }
.gr-field label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.3px; }
.gr-field input {
  border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 12px;
  min-height: 44px; background: var(--bg); color: var(--text); width: 100%;
}
.gr-save-btn { min-height: 44px; white-space: nowrap; }
.gr-hint { color: var(--text-muted); font-size: 13px; margin-top: 12px; }

.gr-derived { margin-top: 16px; }
.gr-derived-head { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.gr-asof { font-weight: 400; }
.gr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gr-chip {
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  padding: 8px 12px; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--border-soft); min-width: 72px;
}
.gr-chip-base { border-color: var(--gold); background: rgba(201,168,76,0.10); }
.gr-chip-carat { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.gr-chip-rate { font-size: 13px; font-weight: 700; color: var(--gold-dark); white-space: nowrap; }

.gr-current-value {
  margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(196,120,138,0.08));
  border: 1px solid var(--border-soft);
}
.gr-cv-label { font-size: 12px; color: var(--text-muted); }
.gr-cv-amount { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 700; color: var(--gold-dark); }

.gr-trend { margin-top: 18px; }
.gr-trend-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.gr-trend-svg { width: 100%; height: auto; display: block; }
.gr-trend-hint { text-align: center; padding: 20px 0; }
.gr-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 6px; font-size: 12px; color: var(--text-muted); }
.gr-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.gr-chart-wrap { position: relative; }
.gr-mark { stroke: var(--card-bg); stroke-width: 2; pointer-events: none; }
.gr-hit { fill: transparent; cursor: pointer; }
.gr-mark-hollow { fill: var(--card-bg); stroke-width: 2; }
.gr-outlier-ring { fill: none; stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 3 2; }
.gr-tip-warn { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-soft); color: var(--danger); }
.gr-flag { color: var(--danger); font-weight: 600; font-size: 11px; white-space: nowrap; }
.gr-point-label { text-anchor: end; font-weight: 600; fill: var(--text); }
.gr-tip {
  position: absolute; z-index: 5; max-width: min(300px, 100%); pointer-events: none;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; color: var(--text);
}
.gr-tip-date { color: var(--text-muted); margin-bottom: 2px; }
.gr-tip-val { font-weight: 600; font-size: 14px; }
.gr-tip-unit { font-weight: 400; font-size: 11px; color: var(--text-muted); }
.gr-tip-item { display: flex; justify-content: space-between; gap: 12px; margin-top: 3px; color: var(--text-muted); }
.gr-tip-item span:last-child { color: var(--text); white-space: nowrap; }
.gr-table-details { margin-top: 6px; }
.login-legal { font-size: 11.5px; color: var(--text-muted); text-align: center; margin: 14px 0 0; line-height: 1.5; }
.login-legal a, .account-legal a { color: var(--text-muted); text-decoration: underline; }
.account-legal { font-size: 13px; text-align: center; margin: 16px 0 0; }
.danger-card { border: 1px solid rgba(192, 57, 43, 0.35); }
.danger-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 0 0 12px; }
.delete-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.plan-name { font-size: 18px; font-weight: 700; color: var(--gold-dark); }
.plan-exp { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.plan-usage { font-size: 13px; color: var(--text); margin-top: 4px; }
.plan-bar { height: 6px; background: var(--border-soft); border-radius: 3px; margin: 8px 0 4px; overflow: hidden; }
.plan-bar-fill { height: 100%; background: var(--gold); border-radius: 3px; }
.plan-bar-fill.plan-bar-full { background: var(--danger); }
.plan-limits { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.gr-save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; }
.gr-save-row .gr-hint { margin-top: 0; font-size: 12px; }
.gr-rate-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.gr-rate-table th, .gr-rate-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.gr-rate-table th { color: var(--text-muted); font-weight: 600; }
.gr-rate-table td:nth-child(1), .gr-rate-table td:nth-child(3) { white-space: nowrap; }
.gr-rate-table td:nth-child(3) { font-weight: 600; }
.gr-grid { stroke: var(--border-soft); stroke-width: 1; }
.gr-axis-label { fill: var(--text-muted); font-size: 11px; }
.gr-axis-y { text-anchor: end; }
.gr-axis-x { text-anchor: middle; }
.gr-dot { fill: var(--gold-dark); stroke: #fff; stroke-width: 1.5; cursor: pointer; }

.gr-history { margin-top: 14px; }
.gr-history-details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); padding: 6px 0; }
.gr-history-list { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.gr-history-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; background: var(--bg);
}
.gr-history-date { flex: 1; font-size: 13px; color: var(--text); }
.gr-history-row { flex-wrap: wrap; }
.gr-edit-date, .gr-edit-rate {
  padding: 6px 8px; border: 1.5px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 13px; background: var(--card-bg); color: var(--text); min-width: 0;
}
.gr-edit-date { flex: 1 1 140px; }
.gr-edit-rate { flex: 1 1 110px; }
.gr-history-rate { font-size: 13px; font-weight: 600; color: var(--gold-dark); white-space: nowrap; }
.gr-history-unit { font-weight: 400; color: var(--text-muted); font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Large Desktop ≥ 1280px ─────────────────────────────────────────────────── */
@media (min-width: 1280px) {
  .stats-grid         { grid-template-columns: repeat(5, 1fr); }
  .recent-list        { grid-template-columns: repeat(5, 1fr); }
  .items-grid         { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .modal-overlay      { align-items: center; padding: 24px; }
  .modal              { border-radius: 20px; max-width: 720px; max-height: 88vh; }
  .modal-close        { position: absolute; top: 14px; right: 16px; float: none; margin: 0; }
  .detail-grid        { grid-template-columns: repeat(3, 1fr); }
  .doc-viewer-overlay { padding: 24px; }
  .doc-viewer-modal   { border-radius: 14px; max-width: 960px; margin: auto; max-height: calc(100vh - 48px); }
}

/* ── Desktop 1024–1279px ─────────────────────────────────────────────────────── */
@media (min-width: 1024px) and (max-width: 1279px) {
  .stats-grid         { grid-template-columns: repeat(5, 1fr); gap: 14px; }
  .stat-card          { padding: 18px 14px 16px; }
  .stat-value         { font-size: 17px; }
  .recent-list        { grid-template-columns: repeat(4, 1fr); }
  .items-grid         { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .modal-overlay      { align-items: center; padding: 20px; }
  .modal              { border-radius: 20px; max-width: 680px; max-height: 88vh; }
  .modal-close        { position: absolute; top: 14px; right: 16px; float: none; margin: 0; }
  .detail-grid        { grid-template-columns: repeat(3, 1fr); }
  .doc-viewer-overlay { padding: 20px; }
  .doc-viewer-modal   { border-radius: 12px; max-width: 900px; margin: auto; max-height: calc(100vh - 40px); }
}

/* ── Tablet Landscape 768–1023px ─────────────────────────────────────────────── */
@media (max-width: 1023px) {
  /* Two-column stat grid: an odd last tile takes the full row */
  .stats-grid > .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  :root { --sidebar-w: 210px; }

  /* Dashboard */
  .stats-grid       { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .dashboard-grid   { grid-template-columns: 1fr 1fr; }
  .recent-list      { grid-template-columns: repeat(3, 1fr); }
  .dash-hero-title  { font-size: 26px; }

  /* Form */
  .form-grid        { grid-template-columns: 1fr; }

  /* Collection */
  .items-grid       { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

  /* Modal */
  .modal-overlay    { align-items: center; padding: 16px; }
  .modal            { border-radius: 18px; max-width: 640px; max-height: 90vh; }
  .modal-close      { position: absolute; top: 14px; right: 16px; float: none; margin: 0; }
  .detail-grid      { grid-template-columns: repeat(2, 1fr); }
}

/* ── Tablet Portrait 600–767px ───────────────────────────────────────────────── */
@media (min-width: 600px) and (max-width: 767px) {
  /* Sidebar slides in as drawer, bottom nav shown */
  .sidebar           { transform: translateX(-100%); width: 260px; box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
  .sidebar.open      { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .sidebar-close     { display: flex; }
  .hamburger         { display: flex; }
  .main              { margin-left: 0; }
  .bottom-nav        { display: flex; }
  .add-fab-desktop   { display: none; }

  /* Page padding */
  #page-collection, #page-add, #page-categories {
    padding: 16px;
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }
  #page-dashboard { padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom)); }

  /* Dashboard */
  .stats-grid     { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px 16px 0; }
  .dash-section   { padding: 24px 16px 8px; }
  .dashboard-grid { grid-template-columns: 1fr; padding: 14px 16px 80px; gap: 12px; }
  .recent-list    { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .dash-hero      { padding: 28px 20px 24px; }
  .dash-hero-title { font-size: 24px; }
  #portfolio-row  { padding: 0 16px 4px; }

  /* Collection */
  .topbar          { padding: 0 16px; }
  .items-grid      { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .item-card-img   { height: 130px; }
  .filter-bar      { gap: 8px; }
  .search-box input { width: 180px; }

  /* Form */
  .form-section    { padding: 16px; }
  .form-grid       { grid-template-columns: 1fr; }

  /* Modal */
  .modal-overlay   { align-items: flex-end; padding: 0; }
  .modal           { border-radius: 20px 20px 0 0; max-width: 100%; max-height: 92vh; }
  .modal-close     { position: sticky; top: 12px; float: right; margin: 12px 14px 0 0; }
  .detail-grid     { grid-template-columns: repeat(2, 1fr); }
  .detail-img-wrap, .detail-img-placeholder { height: 220px; }
}

/* ── Mobile < 600px ──────────────────────────────────────────────────────────── */
@media (max-width: 599px) {
  /* Sidebar drawer */
  .sidebar           { transform: translateX(-100%); width: 260px; box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
  .sidebar.open      { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .sidebar-close     { display: flex; }
  .hamburger         { display: flex; }
  .main              { margin-left: 0; }
  .bottom-nav        { display: flex; }
  .add-fab-desktop   { display: none; }

  /* Topbar */
  .topbar          { padding: 0 12px; height: 56px; }
  .page-title      { font-size: 18px; }
  .search-box input { width: 130px; font-size: 14px; padding: 7px 32px 7px 12px; }

  /* Page padding for bottom nav */
  #page-collection, #page-add, #page-categories {
    padding: 12px;
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  }
  #page-dashboard { padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom)); }

  /* ── Dashboard ── */
  .dash-hero           { padding: 24px 16px 20px; min-height: 150px; }
  .dash-hero-eyebrow   { font-size: 10px; letter-spacing: 2px; margin-bottom: 8px; }
  .dash-hero-title     { font-size: 22px; }
  .dash-hero-sub       { font-size: 12px; }
  .dash-hero-gems      { right: 12px; }
  .gem-float.g1        { font-size: 22px; }
  .gem-float.g2        { font-size: 16px; }
  .gem-float.g3        { font-size: 13px; }

  .stats-grid          { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 14px 12px 0; }
  .stat-card           { padding: 14px 12px; border-radius: 14px; }
  .stat-card-icon      { font-size: 20px; margin-bottom: 8px; }
  .stat-value          { font-size: 15px; }
  .stat-label          { font-size: 10px; letter-spacing: 0.5px; }
  .stat-card-deco      { font-size: 16px; }

  .dash-section        { padding: 20px 12px 6px; }
  .dash-section-title  { font-size: 16px; }
  .dash-section-rule   { flex: 0 0 16px; }
  .recent-list         { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .recent-card-img     { height: 88px; font-size: 28px; }
  .recent-card-body    { padding: 8px 10px; }
  .recent-card-name    { font-size: 11px; }
  .recent-card-value   { font-size: 11px; }

  .dashboard-grid      { grid-template-columns: 1fr; padding: 14px 12px 80px; gap: 10px; }
  .dash-chart-card     { padding: 16px; }
  .dash-chart-title    { font-size: 14px; }
  .bar-label           { width: 70px; font-size: 11px; }
  #portfolio-row       { padding: 0 12px 4px; }
  .portfolio-compare   { padding: 14px 14px 12px; }
  .portfolio-compare-val { font-size: 14px; }
  .portfolio-gain-badge { font-size: 13px; }
  .donut-wrap          { width: 140px; height: 140px; }
  .top-piece-img       { width: 40px; height: 40px; }
  .top-piece-name      { font-size: 13px; }

  /* ── Collection ── */
  .filter-bar          { margin-bottom: 12px; gap: 8px; }
  .filter-row          { gap: 6px; }
  .filter-select       { font-size: 12px; padding: 8px 10px; min-height: 40px; border-radius: 20px; }
  .items-grid          { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .item-card-img       { height: 120px; font-size: 34px; }
  .item-card-body      { padding: 10px 10px 6px; }
  .item-card-name      { font-size: 13px; }
  .item-card-cat       { font-size: 11px; margin-bottom: 4px; }
  .item-card-footer    { padding: 8px 10px; }
  .item-card-value     { font-size: 13px; }
  .icon-btn            { min-width: 32px; min-height: 32px; font-size: 13px; }

  /* ── Add/Edit Form ── */
  .form-grid           { grid-template-columns: 1fr; gap: 0; }
  .form-section        { padding: 14px; margin-bottom: 10px; border-radius: 12px; }
  .form-section-title  { font-size: 13px; margin-bottom: 12px; }
  .form-group label    { font-size: 10px; }
  .form-group input,
  .form-group select,
  .form-group textarea { padding: 9px 11px; border-radius: 7px; font-size: 16px; }
  .form-row            { grid-template-columns: 1fr 1fr; gap: 8px; }
  .form-row-3          { grid-template-columns: 1fr 1fr; }
  .image-preview       { height: 110px; }
  .form-actions        { flex-direction: column-reverse; gap: 8px; }
  .form-actions .btn   { width: 100%; }
  .doc-group-header    { padding: 10px 12px; gap: 8px; }
  .doc-group-actions   { gap: 6px; }
  .doc-group-actions .btn-sm { padding: 6px 10px; font-size: 12px; }
  .doc-preview-list    { padding: 10px 12px; gap: 8px; }
  .insurance-panel     { padding: 12px; }

  /* ── Item Detail Modal ── */
  .modal               { border-radius: 18px 18px 0 0; max-height: 94vh; }
  .detail-img-wrap,
  .detail-img-placeholder { height: 190px; font-size: 56px; }
  .detail-body         { padding: 16px; padding-bottom: calc(16px + var(--safe-bottom)); }
  .detail-title        { font-size: 19px; }
  .detail-grid         { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .detail-field-label  { font-size: 9px; }
  .detail-field-value  { font-size: 13px; }
  .detail-actions      { gap: 8px; margin-top: 16px; }
  .history-row         { font-size: 12px; }

  /* ── Categories ── */
  .add-category-form input { min-width: 120px; }

  /* ── Doc Viewer ── */
  .doc-viewer-topbar   { padding: 10px 12px; }
  .doc-viewer-name     { font-size: 12px; }
}

/* ── Small Mobile < 380px ────────────────────────────────────────────────────── */
@media (max-width: 379px) {
  .stats-grid          { grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 10px 0; }
  .stat-value          { font-size: 13px; }
  .stat-card           { padding: 12px 10px; }
  .stat-card-icon      { font-size: 18px; margin-bottom: 6px; }

  .items-grid          { grid-template-columns: 1fr 1fr; gap: 8px; }
  .item-card-img       { height: 100px; font-size: 28px; }

  .form-row            { grid-template-columns: 1fr; }
  .form-row-3          { grid-template-columns: 1fr; }
  .dash-hero-title     { font-size: 19px; }
  .dash-hero-gems      { display: none; }

  .recent-list         { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .recent-card-img     { height: 72px; font-size: 24px; }

  .filter-select       { font-size: 11px; padding: 7px 8px; }
  .topbar              { padding: 0 10px; }
  .page-title          { font-size: 17px; }
  .search-box input    { width: 110px; }

  .doc-group-actions   { width: 100%; justify-content: flex-end; }
  .detail-grid         { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* ─── Sharing ────────────────────────────────────────────────────────────────── */
.shared-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #1e2f5e, #2d4a8a);
  color: #fff; font-size: 13px; font-weight: 500;
}
.sharing-wrap { max-width: 680px; margin: 0 auto; padding: 28px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.sharing-invite-form { display: flex; flex-direction: column; gap: 12px; }
.sharing-invite-form input[type="email"] { padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; width: 100%; }
.share-access-toggle { display: flex; gap: 20px; }
.share-toggle-opt { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.share-link-box { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--cream); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; color: var(--text-muted); word-break: break-all; margin-top: 8px; }
.share-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.share-item:last-child { border-bottom: none; }
.share-item-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-email { font-weight: 500; font-size: 14px; }
.share-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; }
.share-badge-view { background: #e8f4fd; color: #1a6fa0; }
.share-badge-edit { background: #eafaf1; color: #1e8449; }
.share-status { font-size: 11px; color: var(--text-muted); }
.share-status-pending  { color: var(--gold-dark); }
.share-status-accepted { color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }

/* ─── Import Excel Page ───────────────────────────────────────────────────────── */
.import-wrap { max-width: 860px; margin: 0 auto; padding: 28px 28px 40px; display: flex; flex-direction: column; gap: 20px; }

.import-intro-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.import-intro-icon { font-size: 36px; flex-shrink: 0; }
.import-intro-body { flex: 1; min-width: 0; }
.import-intro-title { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.import-intro-sub   { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

.import-upload-card, .import-preview-card, .import-result-card {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.import-section-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 16px; }

/* Drop zone */
.import-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg);
}
.import-drop-zone.drag-over { border-color: var(--rose-gold); background: var(--rose-light); }
.import-drop-zone:hover     { border-color: var(--rose-gold); }
.import-drop-icon  { font-size: 40px; display: block; margin-bottom: 12px; }
.import-drop-text  { font-size: 15px; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.import-drop-or    { font-size: 12px; color: var(--text-muted); margin: 10px 0; }
.import-drop-hint  { font-size: 12px; color: var(--text-muted); margin-top: 12px; }

/* Preview */
.import-preview-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.import-preview-summary { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.import-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border-soft); }
.import-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.import-table th { background: var(--bg); padding: 10px 12px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.import-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text); vertical-align: middle; }
.import-table tr:last-child td { border-bottom: none; }
.import-table tr:hover td { background: var(--bg); }
.import-row-error td { background: rgba(239,83,80,0.04); }
.import-row-error:hover td { background: rgba(239,83,80,0.07) !important; }

.import-badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.import-badge-ok  { background: rgba(39,174,96,0.12); color: #1d8a50; }
.import-badge-err { background: rgba(239,83,80,0.12); color: #c0392b; cursor: help; }

/* Result */
.import-result-card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 28px; gap: 8px; }
.import-result-icon  { font-size: 52px; }
.import-result-title { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; color: var(--text); }
.import-result-detail { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.6; max-width: 480px; }

@media (max-width: 599px) {
  .import-wrap         { padding: 14px 12px 80px; gap: 14px; }
  .import-intro-card   { padding: 16px 14px; gap: 12px; }
  .import-intro-icon   { font-size: 28px; }
  .import-intro-title  { font-size: 16px; }
  .import-drop-zone    { padding: 28px 16px; }
  .import-drop-icon    { font-size: 32px; }
  .import-table        { font-size: 12px; }
  .import-table th, .import-table td { padding: 8px 10px; }
}

/* ═══════════════════════════════════════════════════════════════
   WEAR EVENTS
═══════════════════════════════════════════════════════════════ */

/* Page header */
.wear-page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 6px;
}
.wear-page-header h2 {
  font-family: 'Playfair Display', serif; font-size: 20px;
  font-weight: 700; color: var(--text); margin: 0;
}
.wear-page-header p {
  font-size: 13px; color: var(--text-muted); margin: 2px 0 0;
}

/* Empty state */
.wear-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px;
  padding: 60px 24px; text-align: center;
}
.wear-empty-icon { font-size: 48px; opacity: .5; }
.wear-empty-text { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* Events list */
.wear-events-list { display: flex; flex-direction: column; gap: 14px; }

/* Event card */
.wear-event-card {
  background: var(--card-bg); border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  display: flex; gap: 0; overflow: hidden;
  transition: box-shadow .2s;
}
.wear-event-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.11); }

.wear-event-date-col,
.wear-event-card-date {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px;
  min-width: 68px; padding: 16px 10px;
  background: linear-gradient(160deg, #1e2f5e 0%, #2d1457 100%);
  color: #fff;
}
.wear-event-day   { font-size: 28px; font-weight: 700; line-height: 1; }
.wear-event-month { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.wear-event-year  { font-size: 11px; opacity: .6; }

.wear-event-body,
.wear-event-card-body {
  flex: 1; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.wear-event-top,
.wear-event-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.wear-event-desc {
  font-size: 14px; font-weight: 600; color: var(--text);
  line-height: 1.4; flex: 1;
}
.wear-event-actions { display: flex; gap: 6px; flex-shrink: 0; }

.occasion-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
  background: rgba(93,63,211,0.10); color: #5d3fd3;
}

/* Items strip on card */
.wear-items-strip { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wear-item-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  background: var(--bg); border: 1px solid rgba(0,0,0,.07);
  font-size: 11px; color: var(--text); max-width: 200px;
}
.wear-item-chip img {
  width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.wear-item-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wear-item-more {
  font-size: 11px; color: var(--text-muted); padding: 2px 6px;
  border-radius: 12px; background: var(--bg); border: 1px solid rgba(0,0,0,.07);
}

/* Photos strip on card */
.wear-photos-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.wear-photos-strip .wear-photo-thumb {
  width: 52px; height: 52px; border-radius: 8px;
  object-fit: cover; cursor: pointer;
  border: 2px solid rgba(255,255,255,.6);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  transition: transform .15s;
}
.wear-photos-strip .wear-photo-thumb:hover { transform: scale(1.06); }

/* ─── Wear Form Modal ────────────────────────────────────────── */
.modal-wear { max-width: 820px; }

.wear-form-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 2px;
}
.wear-form-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

/* Tab bar inside the wear form */
.wear-form-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.wear-tab {
  padding: 10px 18px; font-size: 13px; font-weight: 600;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 7px;
}
.wear-tab:hover { color: var(--text); }
.wear-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.wear-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 20px; font-size: 10px; font-weight: 700;
  background: var(--primary); color: #fff; line-height: 1;
}

/* Tab panels */
.wear-tab-panel { display: none; }
.wear-tab-panel.active { display: block; }

/* Item search */
.wear-item-search-bar {
  width: 100%; padding: 9px 14px; font-size: 13px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text);
  margin-bottom: 14px; box-sizing: border-box;
  outline: none; transition: border-color .2s;
}
.wear-item-search-bar:focus { border-color: var(--primary); }

/* Item selector grid */
.wear-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 360px; overflow-y: auto;
  padding: 4px 2px;
}

.wear-selector-tile {
  position: relative; border-radius: 12px;
  background: var(--card-bg); border: 2px solid var(--border);
  overflow: hidden; cursor: pointer;
  transition: border-color .18s, box-shadow .18s, transform .12s;
}
.wear-selector-tile:hover { border-color: var(--primary-light); transform: translateY(-1px); }
.wear-selector-tile.selected {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(93,63,211,.12);
}

.wear-tile-img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  display: block; background: var(--bg);
}
.wear-tile-img-placeholder {
  width: 100%; aspect-ratio: 1; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}

.wear-tile-check {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: none; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.wear-selector-tile.selected .wear-tile-check { display: flex; }

.wear-tile-info { padding: 7px 8px 8px; }
.wear-tile-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wear-tile-cat { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

/* Photos section in form */
.wear-form-photos { margin-top: 18px; }
.wear-photos-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.wear-photos-label { font-size: 13px; font-weight: 600; color: var(--text); }
.wear-photos-previews {
  display: flex; flex-wrap: wrap; gap: 8px; min-height: 20px;
}
.wear-photo-preview-wrap {
  position: relative; width: 72px; height: 72px;
}
.wear-photo-preview-wrap img {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover;
  border: 2px solid var(--border);
}
.wear-photo-preview-del {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #ef5350; color: #fff; border: none; cursor: pointer;
  font-size: 11px; font-weight: 700; display: flex;
  align-items: center; justify-content: center;
}

/* Wear history panel inside the form (history tab) */
.wear-history-hint {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 14px; line-height: 1.5;
}
.wear-history-list { display: flex; flex-direction: column; gap: 0; }
.wear-history-item-block { margin-bottom: 18px; }
.wear-history-item-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg);
  border-radius: 8px; margin-bottom: 6px;
}
.wear-history-item-header img {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
}
.wear-history-item-name { font-size: 13px; font-weight: 600; color: var(--text); }

.wear-history-entry {
  display: flex; gap: 10px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer;
  transition: background .15s;
}
.wear-history-entry:hover { background: var(--bg); }
.wear-history-date {
  min-width: 78px; font-size: 11px; font-weight: 600;
  color: var(--primary); padding-top: 2px;
}
.wear-history-body { flex: 1; }
.wear-history-desc { font-size: 13px; color: var(--text); font-weight: 500; }
.wear-history-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Item detail modal tabs */
.modal-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  margin: -4px -4px 18px; padding: 0 4px;
}
.modal-tab {
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 6px;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 20px; font-size: 10px; font-weight: 700;
  background: var(--bg); color: var(--text-muted); line-height: 1;
}
.modal-tab.active .tab-count { background: var(--primary); color: #fff; }

.itab-panel { display: none; }
.itab-panel.active { display: block; }
.itab-empty {
  text-align: center; padding: 32px 16px;
  font-size: 13px; color: var(--text-muted); line-height: 1.6;
}
.itab-empty-icon { font-size: 36px; display: block; margin-bottom: 8px; opacity: .5; }

/* Wear history in item detail modal */
#item-wear-history-content .wear-history-entry {
  border-left: 3px solid var(--border);
  padding-left: 14px; margin-left: 2px;
  border-radius: 0 8px 8px 0;
}
#item-wear-history-content .wear-history-entry:hover {
  border-left-color: var(--primary);
  background: var(--bg);
}

/* Form actions row */
.wear-form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 899px) {
  .modal-wear { max-width: 98vw; }
  .wear-item-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); max-height: 280px; }
}

@media (max-width: 599px) {
  .wear-page-header { flex-direction: column; align-items: flex-start; }
  .wear-event-card { flex-direction: column; }
  .wear-event-date-col,
  .wear-event-card-date {
    flex-direction: row; min-width: unset; width: 100%;
    padding: 10px 14px; gap: 6px; justify-content: flex-start;
  }
  .wear-event-day { font-size: 20px; }
  .modal-wear { max-width: 100vw; border-radius: 18px 18px 0 0; margin-top: auto; }
  .wear-item-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); max-height: 240px; }
  .wear-tab { padding: 8px 12px; font-size: 12px; }
  .modal-tab { padding: 8px 12px; font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #162448 0%, #281155 50%, #0E2540 100%);
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 40px 36px 32px;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
}

.login-logo  { text-align: center; margin-bottom: 10px; }
.login-logo img { display: block; margin: 0 auto; width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 6px 18px rgba(11, 26, 71, 0.35); }
.login-title {
  font-family: 'Playfair Display', serif; font-size: 24px;
  font-weight: 700; color: var(--text); text-align: center; margin: 0 0 4px;
}
.login-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin: 0 0 24px; }

/* Tabs */
.login-tabs {
  display: flex; border-radius: 10px; background: var(--bg);
  padding: 3px; margin-bottom: 20px; gap: 2px;
}
.login-tab {
  flex: 1; padding: 8px 12px; font-size: 13px; font-weight: 600;
  border: none; background: none; cursor: pointer; border-radius: 8px;
  color: var(--text-muted); transition: background .15s, color .15s;
}
.login-tab.active {
  background: var(--card-bg); color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* Panels */
.login-panel { display: none; }
.login-panel.active { display: block; }
.login-panel-hint {
  font-size: 13px; color: var(--text-muted); margin: 0 0 16px; line-height: 1.5;
}

.login-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.login-field label { font-size: 12px; font-weight: 600; color: var(--text); }
.login-field input {
  padding: 10px 14px; font-size: 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); outline: none;
  transition: border-color .2s;
}
.login-field input:focus { border-color: var(--primary); }

.login-btn  { width: 100%; padding: 12px; font-size: 14px; font-weight: 600; margin-top: 4px; }
.login-link {
  display: block; width: 100%; text-align: center; margin-top: 10px;
  font-size: 12px; color: var(--text-muted); background: none;
  border: none; cursor: pointer; text-decoration: underline;
}
.login-link:hover { color: var(--primary); }

.login-error {
  display: none; margin-top: 12px; padding: 10px 14px;
  background: rgba(239,83,80,.1); color: #c0392b;
  border-radius: 8px; font-size: 13px; text-align: center;
}

@media (max-width: 480px) {
  .login-card { padding: 28px 20px 24px; border-radius: 16px; }
  .login-title { font-size: 20px; }
}

/* ── Dashboard featured strip fills whole rows ───────────────────────────────
   The app sends 6 pieces; show only as many as complete the row(s) at each
   width, so no piece sits alone: 5 (5 cols) · 4 (4 cols) · 6 (3 cols, 2 rows)
   · 4 (2 cols, 2 rows). Kept at the end so it follows the column rules above. */
.recent-list > .recent-card:nth-child(n+6) { display: none; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .recent-list > .recent-card:nth-child(n+5) { display: none; }
}
@media (max-width: 1023px) {
  .recent-list > .recent-card:nth-child(6) { display: block; }
}
@media (max-width: 599px) {
  .recent-list > .recent-card:nth-child(n+5) { display: none; }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   PREMIUM THEME — royal navy velvet, polished gold, maroon velvet
   Overrides the earlier sidebar, dashboard banner and stat-tile colours.
   ═══════════════════════════════════════════════════════════════════════════════ */
:root {
  --gold-metal: linear-gradient(135deg, #FFF3C4 0%, #F6D06A 28%, #D9A21E 55%, #F8DE8C 75%, #B98112 100%);
  --navy-velvet:
    radial-gradient(ellipse 70% 60% at 22% 12%, rgba(255, 222, 160, 0.22), transparent 60%),
    radial-gradient(ellipse 120% 100% at 50% 40%, #2B4FAE 0%, #1B3784 45%, #0F2260 80%, #0A1845 100%);
  --maroon-velvet:
    radial-gradient(ellipse 70% 60% at 22% 12%, rgba(255, 214, 150, 0.22), transparent 60%),
    radial-gradient(ellipse 120% 100% at 50% 40%, #9A2440 0%, #7A1631 45%, #570C21 80%, #3E0716 100%);
  --gold-border: rgba(243, 201, 105, 0.55);
}

/* Sidebar: ivory & champagne panel in a gold-plated frame (all four sides),
   with a navy-velvet logo header separated from the menu by a gold-plated bar. */
.sidebar {
  background: linear-gradient(170deg, #FFFCF6 0%, #F7EFDF 50%, #EFE2C8 100%);
  border-right: none;
  box-shadow: 4px 0 18px rgba(19, 40, 107, 0.12);
}
.sidebar::before {   /* the frame: layered gold lines read as a bevelled gold edge */
  content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  box-shadow:
    inset 0 0 0 1.5px #7A5206, inset 0 0 0 3px #F8DE8C, inset 0 0 0 4.5px #FFF6D2,
    inset 0 0 0 6px #D9A21E, inset 0 0 0 7.5px #8A5A06, inset 0 0 12px 7px rgba(138, 90, 6, 0.18);
}
.sidebar-header {
  position: relative;
  background: var(--navy-velvet);
  border-bottom: none;
  padding: 22px 20px 26px;
}
.sidebar-header::after {   /* gold-plated bar between the logo header and the menu */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 7px;
  background: linear-gradient(180deg, #7A5206 0%, #F8DE8C 25%, #FFF6D2 42%, #D9A21E 65%, #8A5A06 100%);
  box-shadow: 0 2px 6px rgba(138, 90, 6, 0.30);
}
.logo-icon { width: 42px; height: 42px; border-radius: 10px; filter: none; box-shadow: 0 0 0 1.5px #F3C969, 0 0 14px rgba(243, 201, 105, 0.35); }
.logo-text { background: var(--gold-metal); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-size: 17px; }
.sidebar-close { color: #F3C969; }
.sidebar-close:hover { color: #fff; }
.nav-item { color: #6B5446; }
.nav-item:hover { background: rgba(184, 134, 11, 0.08); color: #8A5A06; }
.nav-item.active { background: linear-gradient(90deg, rgba(201, 168, 76, 0.22), transparent); color: #8A5A06; border-left-color: #B8860B; }
.sidebar-footer { border-top: 1px solid rgba(184, 134, 11, 0.25); color: rgba(138, 90, 6, 0.55); }

/* Dashboard banner: navy velvet, metallic gold title, slow sheen sweep */
.dash-hero { background: var(--navy-velvet); }
/* Same gold-plated frame as the sidebar, drawn on top of the banner */
.dash-hero::before {
  content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  box-shadow:
    inset 0 0 0 1.5px #7A5206, inset 0 0 0 3px #F8DE8C, inset 0 0 0 4.5px #FFF6D2,
    inset 0 0 0 6px #D9A21E, inset 0 0 0 7.5px #8A5A06, inset 0 0 14px 7px rgba(138, 90, 6, 0.22);
}
/* No top bar on the dashboard; the banner holds sign-out (and the menu on phones) */
.main.on-dashboard .topbar { display: none; }
.hero-signout {
  position: absolute; top: 16px; right: 18px; z-index: 4;
  width: 38px; height: 38px; border-radius: 50%; font-size: 17px; cursor: pointer;
  background: rgba(255, 255, 255, 0.10); border: 1.5px solid rgba(243, 201, 105, 0.7);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.hero-signout:hover { background: rgba(243, 201, 105, 0.22); transform: scale(1.05); }
.hero-menu { position: absolute; top: 14px; left: 14px; z-index: 4; color: #F3C969; }
.dash-hero .hero-menu { display: none; }
.dash-hero-gems { right: 84px; }   /* clear of the sign-out button */
@media (max-width: 1023px) {
  .dash-hero .hero-menu { display: flex; }
  .dash-hero-content { padding-top: 26px; }
  .dash-hero-gems { right: 64px; }
  .hero-signout { top: 12px; right: 12px; }
}
/* Phones: no room for the large vault beside the title (it is in the menu and app icon) */
@media (max-width: 599px) { .dash-hero-gems { display: none; } }
.dash-hero-orb1 { background: radial-gradient(circle, rgba(255, 214, 150, 0.30) 0%, transparent 70%); }
.dash-hero-orb2 { background: radial-gradient(circle, rgba(120, 160, 255, 0.22) 0%, transparent 70%); }
.dash-hero-orb3 { background: radial-gradient(circle, rgba(255, 236, 200, 0.18) 0%, transparent 70%); }
.dash-hero-eyebrow { color: #F3C969; }
.dash-hero-title { background: var(--gold-metal); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35)); }
.dash-hero-sub { color: rgba(247, 231, 180, 0.75); }
.hero-mark { width: 104px; height: 104px; display: block; filter: drop-shadow(0 0 18px rgba(243, 201, 105, 0.55)); animation: gemFloat 5s ease-in-out infinite; }
.dash-hero-shine {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 240, 210, 0.16) 48%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 240, 210, 0.16) 52%, transparent 65%);
  background-size: 250% 100%; animation: heroShine 7s ease-in-out infinite;
}
@keyframes heroShine { 0% { background-position: 130% 0; } 60%, 100% { background-position: -40% 0; } }
@media (prefers-reduced-motion: reduce) { .dash-hero-shine, .hero-mark { animation: none; } }

/* Stat tiles: velvet jewellery boxes with gold edges and a gloss highlight */
.stat-card {
  border: 1px solid var(--gold-border);
  box-shadow: 0 6px 18px rgba(11, 26, 71, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.stat-card::after {   /* gloss: soft diagonal light across the top */
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 32%, transparent 45%);
}
.stat-card .stat-card-bg { display: none; }
.stat-card.s-gold, .stat-card.s-blush { background: var(--navy-velvet); }
.stat-card.s-rose, .stat-card.s-pearl { background: var(--maroon-velvet); }
.stat-card .stat-value {
  /* top-to-bottom gold so every digit has the same colour */
  background: linear-gradient(180deg, #FFF0B5 0%, #F6CE5C 50%, #D9A21E 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.stat-card .stat-label { color: rgba(247, 231, 180, 0.72); }
.stat-card .stat-card-deco { color: rgba(243, 201, 105, 0.16); }
/* Current Metal Value: a polished gold bar */
.stat-card.s-amber { background: var(--gold-metal); border-color: rgba(138, 90, 6, 0.55); }
.stat-card.s-amber .stat-value { background: none; -webkit-text-fill-color: #0F2260; color: #0F2260; filter: none; }
.stat-card.s-amber .stat-label { color: rgba(15, 34, 96, 0.75); }
.stat-card.s-amber .stat-card-deco { color: rgba(15, 34, 96, 0.18); }
.stat-card.s-amber::after { background: linear-gradient(160deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.08) 35%, transparent 50%); }

/* Dashboard: a single, full-width "By Category" chart (material chart removed) */
.dashboard-grid { grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .dash-chart-wide #category-chart { display: flex; align-items: center; justify-content: center; gap: 40px; }
  .dash-chart-wide .donut-wrap { margin: 0; width: 180px; height: 180px; flex-shrink: 0; }
  .dash-chart-wide .donut-legend { justify-content: flex-start; max-width: 520px; }
}
.cover-actions { margin-top: 10px; }

/* Back arrow, top right of every page's top bar */
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.back-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy-velvet, #13286B); color: #F3C969;
  border: 1.5px solid rgba(208, 154, 28, 0.85);
  box-shadow: 0 2px 6px rgba(19, 40, 107, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}
.back-btn:hover { transform: translateX(-2px); box-shadow: 0 3px 10px rgba(19, 40, 107, 0.35); }
/* Add/Edit form: let columns and fields shrink to the screen (was 528px wide on a 390px phone) */
.form-col, .form-section, .form-row > *, .form-group { min-width: 0; }
.form-group input, .form-group select, .form-group textarea { max-width: 100%; }

/* Add/Edit form: collapsible panels (tap the title) */
.sub-panel-title {
  font-family: 'Playfair Display', serif; font-size: 13px; font-weight: 600; color: var(--rose-dark);
  margin: 0 0 12px;
}
.collapsible > .form-section-title,
.collapsible > .sub-panel-title {
  display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.collapsible > .form-section-title:focus-visible,
.collapsible > .sub-panel-title:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.collapse-chevron {
  margin-left: auto; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(208, 154, 28, 0.12); border: 1px solid rgba(208, 154, 28, 0.45);
  transition: transform 0.25s ease, background 0.2s;
}
.collapse-chevron::before {
  content: ''; width: 7px; height: 7px; margin-top: -3px;
  border-right: 2px solid #9A6B0C; border-bottom: 2px solid #9A6B0C; transform: rotate(45deg);
}
.collapsible > :hover > .collapse-chevron { background: rgba(208, 154, 28, 0.24); }
.collapsible.collapsed > * > .collapse-chevron { transform: rotate(-90deg); }
.collapsible.collapsed > .collapse-body { display: none; }
.collapsible.collapsed > .form-section-title { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.collapsible.collapsed > .sub-panel-title { margin-bottom: 0; }

/* ─── Users page (owner only) ─────────────────────────────────────────────── */
.users-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.users-tile {
  background: var(--navy-velvet, #13286B); border: 1px solid rgba(208, 154, 28, 0.6); border-radius: var(--radius);
  padding: 16px 18px; color: #F6E7C1; box-shadow: var(--shadow-sm);
}
.users-tile-val { font: 700 28px/1.1 'Playfair Display', serif; color: #F3C969; }
.users-tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.users-tile-sub { font-size: 12px; opacity: 0.75; margin-top: 4px; }
.users-card { padding: 18px 20px; }
.users-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.users-toolbar input { max-width: 240px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); }
.user-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--border-soft);
}
.user-email { font-weight: 600; overflow-wrap: anywhere; }
.user-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.user-stats { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.user-stats strong { color: var(--text); }
.user-plan { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-bg); }
.user-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.user-badge-owner { background: #6B1F2E; color: #F3C969; }
.user-badge-warn { background: #FFF1D6; color: #8A5A06; border: 1px solid #F0D58C; }
.users-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; }
@media (max-width: 900px) { .users-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) {
  .user-row { grid-template-columns: minmax(0, 1fr) auto; }
  .user-stats { grid-column: 1 / -1; grid-row: 2; }
  .users-toolbar { flex-wrap: wrap; }
  .users-toolbar input { max-width: none; width: 100%; }
  .users-tile-val { font-size: 22px; }
}
/* Page body padding for pages that use .page-content (Account, Users) */
.page-content { padding: 24px 28px 40px; }
@media (max-width: 599px) { .page-content { padding: 16px 16px 32px; } }

/* ─── Pop-up dialogs (feedback form, set-password prompt) ─────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300; background: rgba(10, 24, 69, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.modal-box {
  width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--card-bg); border-radius: 18px; padding: 22px 22px 18px;
  border: 1px solid rgba(208, 154, 28, 0.55); box-shadow: 0 18px 50px rgba(10, 24, 69, 0.35);
}
.modal-box h3 { font: 700 20px/1.3 'Playfair Display', serif; color: #13286B; margin: 0 0 6px; }

/* ─── Feedback form ─────────────────────────────────────────────────────────── */
.fb-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; }
.fb-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 12px 0 6px; }
.fb-optional { font-weight: 400; text-transform: none; letter-spacing: 0; }
.fb-stars { display: flex; gap: 4px; }
.fb-stars button {
  font-size: 30px; line-height: 1; background: none; border: none; cursor: pointer; padding: 2px;
  color: #D9CFC2; transition: transform 0.15s, color 0.15s;
}
.fb-stars button.on { color: #D09A1C; text-shadow: 0 1px 0 #8A5A06; }
.fb-stars button:hover { transform: scale(1.12); }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-kinds button {
  padding: 7px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
}
.fb-kinds button.on { background: #13286B; border-color: #D09A1C; color: #F3C969; }
#fbMessage {
  width: 100%; margin-top: 12px; padding: 10px 12px; border-radius: 10px; resize: vertical;
  border: 1px solid var(--border); background: var(--bg); font: inherit; font-size: 14px;
}
.fb-shot-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-width: 0; }
.fb-shot-name { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* One-time prompt, bottom of the screen above the phone nav */
.fb-nudge {
  position: fixed; z-index: 250; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + var(--safe-bottom)); width: min(440px, calc(100% - 32px));
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px;
  background: var(--navy-velvet, #13286B); color: #F6E7C1; border: 1px solid rgba(208, 154, 28, 0.7);
  box-shadow: 0 12px 34px rgba(10, 24, 69, 0.4); font-size: 13px;
}
.fb-nudge strong { color: #F3C969; font-size: 14px; }
.fb-nudge-actions { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }
@media (max-width: 1023px) { .fb-nudge { bottom: calc(var(--bottom-nav-h) + 14px + var(--safe-bottom)); } }
@media (max-width: 420px) { .fb-nudge { flex-wrap: wrap; } .fb-nudge-actions { margin-left: 0; width: 100%; justify-content: flex-end; } }

/* ─── Users page: tabs and feedback list ───────────────────────────────────── */
.users-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.users-tab {
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px;
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
}
.users-tab.active { background: #13286B; border-color: #D09A1C; color: #F3C969; }
.users-tab-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: #B3304E; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.users-tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#fbFilter { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); }
.fb-item { padding: 14px 0; border-top: 1px solid var(--border-soft); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
.fb-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fb-item-stars { color: #D09A1C; letter-spacing: 1px; }
.fb-kind { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }
.fb-kind-problem { background: #FDE8EC; border-color: #F2B8C4; color: #8B1E36; }
.fb-kind-idea { background: #FFF6DD; border-color: #F0D58C; color: #7A5306; }
.fb-kind-praise { background: #E6F6EE; border-color: #A8DDC0; color: #1E6B45; }
.fb-item-msg { grid-column: 1 / -1; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.fb-item-meta { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); }
.fb-item-shot img { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--border); margin-top: 4px; }
.fb-item select { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-bg); align-self: start; }
.fb-item.fb-new { box-shadow: inset 3px 0 0 #D09A1C; padding-left: 12px; }
@media (max-width: 599px) { .users-tiles-3 { grid-template-columns: 1fr 1fr 1fr; } .users-tiles-3 .users-tile { padding: 12px; } }
