  /* ─── CSS VARIABLES ─────────────────────────────────────────── */
  :root {
    --cream:       #fdf6ec;
    --parchment:   #f5e9d3;
    --rose:        #d4a843;
    --rose-light:  #f0d98a;
    --rose-dark:   #a07820;
    --sage:        #2e7d8c;
    --sage-light:  #b8dce0;
    --sage-dark:   #1a5c6a;
    --gold:        #c9a44a;
    --gold-light:  #e8d5a0;
    --gold-dark:   #9a7a2e;
    --lavender:    #7a9ab8;
    --lavender-light: #c8d8e8;
    --sky:         #4a8ab4;
    --sky-light:   #c0d8f0;
    --pink:        #c4607a;
    --pink-light:  #f2d0d8;
    --pink-dark:   #8a3050;
    --purple:      #8a6ab8;
    --purple-light: #ddd0f0;
    --purple-dark:  #5a3a8a;
    --ink:         #0d1b2e;
    --ink-mid:     #2a4060;
    --ink-light:   #6a7f98;
    --white:       #ffffff;
    --shadow:      rgba(13,27,46,0.14);
    --shadow-deep: rgba(13,27,46,0.28);
    --radius:      14px;
    --radius-sm:   8px;
  }

  /* ─── RESET & BASE ──────────────────────────────────────────── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: 'Lato', sans-serif;
    background: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    background-image:
      radial-gradient(ellipse at 10% 20%, rgba(201,164,74,0.10) 0%, transparent 50%),
      radial-gradient(ellipse at 90% 80%, rgba(13,27,46,0.07) 0%, transparent 50%),
      radial-gradient(ellipse at 50% 50%, rgba(13,27,46,0.05) 0%, transparent 70%);
  }

  /* ─── HEADER ────────────────────────────────────────────────── */
  header {
    background: linear-gradient(135deg, #0a1628 0%, #1a2d4a 100%);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 20px var(--shadow-deep);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
  }

  .header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
  }

  .header-logo {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
  }

  .header-titles {
    min-width: 0;
  }

  .header-titles h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--gold-light);
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-titles p {
    font-size: 0.72rem;
    color: #9aafc4;
    font-style: italic;
    letter-spacing: 1px;
    margin-top: 2px;
    white-space: nowrap;
  }

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

  /* ─── BUTTONS ────────────────────────────────────────────────── */
  .btn {
    font-family: 'Lato', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 50px;
    padding: 9px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
  }

  .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px var(--shadow); }
  .btn:active { transform: translateY(0); }

  .btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(201,164,74,0.35);
  }

  .btn-rose {
    background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(232,164,164,0.35);
  }

  .btn-sage {
    background: linear-gradient(135deg, var(--sage) 0%, var(--sage-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(143,173,143,0.35);
  }

  .btn-lavender {
    background: linear-gradient(135deg, var(--lavender) 0%, #3a6a9a 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(176,164,200,0.35);
  }

  .btn-sky {
    background: linear-gradient(135deg, var(--sky) 0%, #1a5a8a 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(143,184,204,0.35);
  }

  .btn-ghost {
    background: rgba(255,255,255,0.12);
    color: var(--gold-light);
    border: 1px solid rgba(201,164,74,0.4);
  }

  .btn-ghost:hover { background: rgba(255,255,255,0.2); }

  .btn-danger {
    background: linear-gradient(135deg, #e07070 0%, #b04040 100%);
    color: var(--white);
  }

  .btn-sm { font-size: 0.75rem; padding: 7px 14px; }
  .btn-cancel { color: var(--ink-mid); }
  .btn-signout {
    border-color: rgba(224,112,112,0.5);
    color: #f0a0a0;
  }
  .btn-clear-photo {
    background: var(--rose-light);
    color: var(--rose-dark);
    border: none;
  }
  .btn-splash-signin {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 14px 20px;
  }

  .header-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: block;
  }

  /* ─── STATUS PILL ────────────────────────────────────────────── */
  #auth-status {
    font-size: 0.72rem;
    padding: 6px 12px;
    border-radius: 50px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
  }
  #auth-status.connected { background: rgba(46,125,140,0.3); color: #7ad4e0; border: 1px solid rgba(46,125,140,0.5); }
  #auth-status.disconnected { background: rgba(232,164,164,0.2); color: var(--rose-light); border: 1px solid rgba(232,164,164,0.3); }

  /* ─── MAIN LAYOUT ────────────────────────────────────────────── */
  main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 24px;
  }

  /* ─── SECTION TITLES ─────────────────────────────────────────── */
  .section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--ink);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
  }

  .section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--gold-light), transparent);
    margin-left: 8px;
  }

  /* ─── ADD ITEM PANEL ─────────────────────────────────────────── */
  #add-panel {
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(13,27,46,0.70);
    backdrop-filter: blur(3px);
    padding: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
  }

  #add-panel.open { display: flex; }

  #add-panel .add-panel-shell {
    width: min(1100px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(13,27,46,0.45);
    border: 1px solid var(--parchment);
    padding: 30px;
  }

  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .form-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
    align-items: start;
  }

  /* ─── PHOTO ZONE ─────────────────────────────────────────────── */
  .photo-zone {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .photo-drop {
    width: 100%;
    aspect-ratio: 3/4;
    border: 2.5px dashed var(--gold-light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--parchment);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
  }

  .photo-drop:hover { border-color: var(--gold); background: var(--gold-light); }
  .photo-drop.dragover { border-color: var(--gold); background: var(--gold-light); }
  .photo-drop.has-image { border-style: solid; border-color: var(--gold); }

  .photo-drop img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius) - 3px);
  }

  .photo-placeholder {
    text-align: center;
    color: var(--ink-light);
    font-size: 0.82rem;
    padding: 20px;
    pointer-events: none;
  }

  .photo-placeholder span { font-size: 2.8rem; display: block; margin-bottom: 8px; }
  .photo-placeholder-note {
    margin-top: 6px;
    font-size: 0.75rem;
    opacity: 0.7;
  }

  .photo-size-note {
    font-size: 0.72rem;
    color: var(--ink-light);
    text-align: center;
    font-style: italic;
  }

  /* ─── FORM FIELDS ────────────────────────────────────────────── */
  .form-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

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

  .field-row.three { grid-template-columns: 1fr 1fr 1fr; }

  .field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .field-group label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--ink-mid);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .field-group input,
  .field-group select,
  .field-group textarea {
    font-family: 'Lato', sans-serif;
    font-size: 0.92rem;
    color: var(--ink);
    background: var(--cream);
    border: 1.5px solid var(--parchment);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    width: 100%;
  }

  .field-group input:focus,
  .field-group select:focus,
  .field-group textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,164,74,0.15);
  }

  .field-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
  }

  /* Select colour accents per field */
  select.type-select:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(232,164,164,0.15); }
  select.century-select:focus { border-color: var(--lavender); box-shadow: 0 0 0 3px rgba(176,164,200,0.15); }
  select.country-select:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(143,184,204,0.15); }
  select.condition-select:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(143,173,143,0.15); }

  .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
  }

  /* ─── TOOLBAR ────────────────────────────────────────────────── */
  .toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
  }

  .toolbar-left {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
  }

  .toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
  }

  .search-box {
    position: relative;
    flex: 1;
    min-width: 130px;
    max-width: 260px;
  }

  .search-box input {
    font-family: 'Lato', sans-serif;
    font-size: 0.88rem;
    padding: 9px 14px 9px 36px;
    border: 1.5px solid var(--parchment);
    border-radius: 50px;
    background: var(--white);
    color: var(--ink);
    outline: none;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
  }

  .search-box input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,164,74,0.12);
  }

  .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-light);
    font-size: 0.9rem;
    pointer-events: none;
  }

  .filter-select {
    font-family: 'Lato', sans-serif;
    font-size: 0.82rem;
    padding: 8px 10px;
    border: 1.5px solid var(--parchment);
    border-radius: 50px;
    background: var(--white);
    color: var(--ink);
    outline: none;
    cursor: pointer;
    max-width: 140px;
  }

  .count-pill {
    font-size: 0.78rem;
    padding: 5px 12px;
    border-radius: 50px;
    background: var(--parchment);
    color: var(--ink-mid);
    font-weight: 700;
    border: 1px solid var(--gold-light);
  }

  /* ─── LIST VIEW ──────────────────────────────────────────────── */
  #collection-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* ─── LIST ROW ───────────────────────────────────────────────── */
  .antique-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--parchment);
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
    animation: cardIn 0.3s ease both;
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
  }

  @keyframes cardIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
  }

  .antique-card:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 18px var(--shadow-deep);
    border-color: var(--gold-light);
  }

  /* Coloured left accent bar, colour varies by type */
  .card-accent {
    width: 5px;
    align-self: stretch;
    flex-shrink: 0;
    background: var(--gold-light);
  }

  .card-emoji {
    font-size: 1.6rem;
    padding: 14px 14px 14px 16px;
    flex-shrink: 0;
    line-height: 1;
  }

  .card-body {
    flex: 1;
    padding: 12px 14px 12px 0;
    min-width: 0;
  }

  .card-name {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 5px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
  }

  .tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 50px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
  }

  .tag-type      { background: var(--pink-light);   color: var(--pink-dark); }
  .tag-century   { background: var(--purple-light); color: var(--purple-dark); }
  .tag-country   { background: var(--sky-light);    color: #1a5a8a; }
  .tag-condition { background: #fde0c8;             color: #8a3a10; }

  .card-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold-dark);
  }

  .card-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 12px 10px 0;
    flex-shrink: 0;
  }

  /* Photo indicator — small camera icon if photo exists */
  .card-has-photo {
    font-size: 0.7rem;
    color: var(--ink-light);
    padding: 2px 0;
    text-align: center;
  }

  /* ─── CARD THUMBNAIL ─────────────────────────────────────────── */
  .card-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--parchment);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0 10px 10px;
    border: 1px solid var(--parchment);
  }

  .card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
  }

  .card-thumb-placeholder {
    font-size: 1.4rem;
    opacity: 0.45;
  }

  .card-thumb-loading {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(13,27,46,0.12);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }

  /* ─── EMPTY STATE ────────────────────────────────────────────── */
  #empty-state {
    text-align: center;
    padding: 80px 20px;
    display: none;
  }

  #empty-state.show { display: block; }

  #empty-state .empty-icon { font-size: 5rem; margin-bottom: 16px; }

  #empty-state h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--ink-mid);
    margin-bottom: 8px;
  }

  #empty-state p { color: var(--ink-light); font-size: 0.9rem; }

  /* ─── MODAL ──────────────────────────────────────────────────── */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13,27,46,0.70);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(3px);
  }

  .modal-overlay.is-open { display: flex; }

  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(13,27,46,0.45);
    animation: modalIn 0.25s ease;
  }

  @keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }

  .modal-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--parchment);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
  }

  .modal-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--ink);
    font-weight: 600;
  }

  .modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--ink-light);
    line-height: 1;
    padding: 2px;
    transition: color 0.15s;
    flex-shrink: 0;
  }

  .modal-close:hover { color: var(--rose-dark); }

  .modal-body { padding: 24px 28px; }
  .modal-title { font-family: 'Playfair Display', serif; }
  .modal-copy {
    margin-bottom: 18px;
    color: var(--ink-mid);
    font-size: 0.9rem;
  }

  .modal-photo {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--parchment);
    margin-bottom: 20px;
  }

  .modal-photo-placeholder {
    width: 100%;
    height: 180px;
    background: var(--parchment);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    margin-bottom: 20px;
  }

  .modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

  .modal-description {
    font-size: 0.92rem;
    color: var(--ink-mid);
    line-height: 1.7;
    margin-bottom: 16px;
  }

  .modal-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
  }

  .meta-item { font-size: 0.82rem; }
  .meta-label { font-weight: 700; color: var(--ink-mid); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.6px; }
  .meta-value { color: var(--ink); margin-top: 2px; }

  .modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
  }
  .modal-loading {
    width: 100%;
    height: 200px;
    background: var(--parchment);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--ink-mid);
    font-size: 0.85rem;
    margin-bottom: 20px;
  }
  .modal-loading .spinner {
    border-color: rgba(13,27,46,0.15);
    border-top-color: var(--ink-mid);
  }

  /* ─── TOAST ──────────────────────────────────────────────────── */
  .toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 4px 16px var(--shadow-deep);
    animation: toastIn 0.3s ease;
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  @keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
  }

  .toast-success { background: var(--sage); color: var(--white); }
  .toast-error   { background: #c06060; color: var(--white); }
  .toast-info    { background: var(--ink); color: var(--gold-light); }

  /* ─── LOADING SPINNER ────────────────────────────────────────── */
  .spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
  }
  .spinner-light {
    border-color: rgba(255,255,255,0.3);
    border-top-color: white;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ─── EXPORT MODAL ───────────────────────────────────────────── */
  .export-option {
    background: var(--cream);
    border: 1.5px solid var(--parchment);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
  }

  .export-option:hover { border-color: var(--gold); background: var(--gold-light); transform: translateX(3px); }
  .export-option .eo-icon { font-size: 2rem; flex-shrink: 0; }
  .export-option h4 { font-family: 'Playfair Display', serif; font-size: 1rem; margin-bottom: 3px; }
  .export-option p { font-size: 0.78rem; color: var(--ink-mid); }

  /* ─── RESPONSIVE ─────────────────────────────────────────────── */

  /* Prevent ANY horizontal scroll on all screen sizes */
  html, body { max-width: 100%; overflow-x: hidden; }

  @media (max-width: 768px) {
    main { padding: 16px 12px; }

    /* Form */
    .form-grid { grid-template-columns: 1fr; }
    .photo-drop { aspect-ratio: 16/9; }
    .field-row { grid-template-columns: 1fr; }
    .field-row.three { grid-template-columns: 1fr 1fr; }
    .form-actions { flex-wrap: wrap; }

    /* Toolbar — stack export/sync below filters on mobile */
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left { width: 100%; }
    .toolbar-right { width: 100%; justify-content: flex-end; }

    /* Header: subtitle hidden on small screens to save space */
    .header-titles p { display: none; }
    .header-titles h1 { font-size: 1.1rem; }
  }

  @media (max-width: 500px) {
    .field-row.three { grid-template-columns: 1fr; }

    /* Header: stack brand and actions on very small phones */
    header { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
    .header-brand { width: 100%; }
    .header-actions {
      width: 100%;
      justify-content: space-between;
    }
    /* Make connect + add buttons share the full width */
    #btn-connect { flex: 1; justify-content: center; }
    .btn-gold#btn-add-item { flex: 1; justify-content: center; }
    #auth-status { font-size: 0.68rem; }

    /* Modal slides up from bottom on phones */
    .modal { border-radius: var(--radius) var(--radius) 0 0; }
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal { max-height: 94vh; }
    #add-panel { padding: 0; align-items: flex-end; }
    #add-panel .add-panel-shell {
      width: 100%;
      max-height: 94vh;
      border-radius: var(--radius) var(--radius) 0 0;
      padding: 22px 18px 24px;
    }
  }

  /* ─── DECORATIVE DIVIDER ─────────────────────────────────────── */
  .ornament {
    text-align: center;
    color: var(--gold-light);
    letter-spacing: 6px;
    font-size: 0.9rem;
    margin: 8px 0;
    opacity: 0.6;
  }

  /* Edit mode badge */
  .editing-badge {
    display: none;
    background: var(--lavender-light);
    color: #5a4a8a;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 700;
    border: 1px solid var(--lavender);
    margin-left: 10px;
  }

  .editing-badge.show { display: inline-flex; align-items: center; gap: 5px; }

  .is-hidden { display: none !important; }

  .auth-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: linear-gradient(135deg, #0d1b2e 0%, #1a2d4a 100%);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 30px;
  }
  .auth-overlay.is-hidden { display: none; }

  .auth-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
  }

  .auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 44px 36px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(13,27,46,0.5);
    text-align: center;
    position: relative;
    z-index: 1;
  }

  .auth-logo-wrap { margin-bottom: 12px; }

  .auth-logo {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    box-shadow: 0 4px 20px rgba(13,27,46,0.22);
    display: block;
    margin: 0 auto;
  }

  .auth-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--ink);
    margin-bottom: 6px;
    font-weight: 700;
  }

  .auth-tagline {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: var(--ink-light);
    font-size: 0.85rem;
    margin-bottom: 28px;
  }

  .auth-rule {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold-light), transparent);
    margin-bottom: 28px;
  }

  .auth-copy {
    color: var(--ink-mid);
    font-size: 0.9rem;
    margin-bottom: 24px;
    line-height: 1.6;
  }

  .auth-note {
    margin-top: 16px;
    font-size: 0.72rem;
    color: var(--ink-light);
    line-height: 1.5;
  }

  .auth-status-connected { background: rgba(46,125,140,0.3); color: #7ad4e0; border: 1px solid rgba(46,125,140,0.5); }
  .auth-status-disconnected { background: rgba(232,164,164,0.2); color: var(--rose-light); border: 1px solid rgba(232,164,164,0.3); }

  #btn-signout.is-hidden,
  #btn-clear-photo.is-hidden,
  #photo-input.is-hidden,
  #photo-preview.is-hidden { display: none !important; }

  #btn-signout,
  #btn-clear-photo,
  #btn-splash-signin { white-space: normal; }

  /* ─── SCROLL TO TOP ─────────────────────────────────────────── */
  #scroll-top {
    position: fixed;
    bottom: 28px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--white);
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--shadow-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.2s ease;
    z-index: 99;
  }

  #scroll-top.visible {
    opacity: 1;
    pointer-events: auto;
  }

  #scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow-deep);
  }

  #scroll-top:active { transform: translateY(0); }

/* ─── Multi-select dropdowns ────────────────────── */
.multiselect {
  position: relative;
}
.multiselect-btn {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: var(--white);
  border: 1.5px solid var(--parchment);
  border-radius: var(--radius-sm);
  font-family: 'Lato', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.multiselect-btn::after {
  content: '▾';
  font-size: 0.7rem;
  color: var(--ink-light);
  flex-shrink: 0;
}
.multiselect.open .multiselect-btn {
  border-color: var(--gold);
}
.multiselect-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.multiselect-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1.5px solid var(--parchment);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px var(--shadow);
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.multiselect.open .multiselect-dropdown {
  display: block;
}
.multiselect-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.1s;
  border-bottom: 1px solid var(--parchment);
}
.multiselect-option:last-child {
  border-bottom: none;
}
.multiselect-option:hover {
  background: var(--parchment);
}
.multiselect-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}

/* On mobile, ensure the dropdown stays within viewport */
@media (max-width: 600px) {
  .multiselect-dropdown {
    min-width: 200px;
  }
}
