.collectors { display: flex; flex-direction: column; gap: 18px; }
.collectors-topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.collectors-search { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.collectors-input { flex: 1; min-width: 240px; height: 48px; padding: 0 14px; border: 1px solid var(--sb-border);
    border-radius: 12px; background: var(--sb-surface-2); font-size: 15px; color: var(--sb-ink); }
.collectors-sort { height: 48px; border: 1px solid var(--sb-border); border-radius: 12px; padding: 0 12px; background: var(--sb-surface-2); }
.collectors-btn { height: 48px; padding: 0 20px; border: 0; border-radius: 12px; cursor: pointer; font-weight: 600;
    background: linear-gradient(135deg, var(--sb-gold), var(--sb-gold-deep)); color: #2b1e15; box-shadow: 0 6px 18px rgba(156,123,69,.3);
    display: inline-flex; align-items: center; text-decoration: none; }
.collectors-empty { color: var(--sb-taupe); font-family: var(--sb-serif); font-size: 20px; padding: 24px 0; }
/* Collector table */
.collectors-tablewrap { overflow-x: auto; background: var(--sb-surface); border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius); box-shadow: 0 8px 24px rgba(52,37,27,.06); }
.collectors-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.collectors-table thead th { text-align: left; font-family: var(--sb-font-sans); font-weight: 600; font-size: 12px;
    letter-spacing: .04em; text-transform: uppercase; color: var(--sb-taupe); padding: 12px 16px;
    border-bottom: 1px solid var(--sb-border); white-space: nowrap; }
.collectors-table td { padding: 13px 16px; border-bottom: 1px solid var(--sb-border); color: var(--sb-ink); vertical-align: middle; }
.collectors-table tbody tr:last-child td { border-bottom: 0; }
.collectors-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.collector-row { cursor: pointer; transition: background .12s ease; }
.collector-row:hover, .collector-row:focus-visible { background: var(--sb-surface-2); outline: none; }
.collector-row-id { color: var(--sb-taupe); margin-right: 6px; }
.collector-row-name { font-family: var(--sb-serif); font-size: 16px; }

/* Stack the table into cards on narrow screens (phone / iPad portrait) */
@media (max-width: 640px) {
    .collectors-tablewrap { overflow-x: visible; background: transparent; border: 0; box-shadow: none; }
    .collectors-table, .collectors-table tbody, .collectors-table tr, .collectors-table td { display: block; width: 100%; }
    .collectors-table thead { display: none; }
    .collector-row { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: var(--sb-radius);
        box-shadow: 0 8px 24px rgba(52,37,27,.06); margin-bottom: 12px; padding: 6px 4px; }
    .collectors-table td { border-bottom: 0; display: flex; justify-content: space-between; gap: 16px; padding: 7px 14px; text-align: right; }
    .collectors-table td::before { content: attr(data-label); font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
        color: var(--sb-taupe); font-weight: 600; align-self: center; }
    .collectors-table .is-num { text-align: right; }
    .collector-row-name { font-size: 15px; }
}
/* Numbered pager */
.collectors-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 18px; }
.collectors-pager-count { color: var(--sb-taupe); font-size: 13px; }
.collectors-pager-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.collectors-page { min-width: 44px; height: 44px; padding: 0 12px; display: inline-flex; align-items: center;
    justify-content: center; border: 1px solid var(--sb-border); border-radius: 12px; background: var(--sb-surface-2);
    color: var(--sb-ink); font-size: 15px; font-weight: 500; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.collectors-page:hover { border-color: var(--sb-gold); }
.collectors-page.is-current { background: linear-gradient(135deg, var(--sb-gold), var(--sb-gold-deep));
    color: #2b1e15; border-color: transparent; cursor: default; }
.collectors-page.is-disabled { opacity: .4; cursor: default; }
.collectors-page-gap { min-width: 24px; text-align: center; color: var(--sb-taupe); }

/* ============================ Detail modal ============================ */
.collectors-modal { position: fixed; inset: 0; background: rgba(52,37,27,.45); display: flex; align-items: center;
    justify-content: center; padding: 3vh 16px; overflow-y: auto; z-index: 50; }
.collectors-modal.hidden { display: none; }

/* Loading / error state shown on the backdrop while the detail partial loads */
.collector-loading { margin: 14vh auto 0; display: flex; flex-direction: column; align-items: center; gap: 14px;
    color: #f4ecdc; text-align: center; padding: 0 20px; }
.collector-loading-txt { font-family: var(--sb-serif); font-size: 18px; }
.collector-spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(244,236,220,.28);
    border-top-color: var(--sb-gold); animation: collector-spin .7s linear infinite; }
@keyframes collector-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .collector-spinner { animation-duration: 1.5s; } }

/* Two-column frame: chocolate identity rail + certificates body */
.collector-detail { position: relative; width: 100%; max-width: 840px; height: 94vh; max-height: 94vh; background: var(--sb-surface);
    border-radius: var(--sb-radius); box-shadow: 0 22px 60px rgba(52,37,27,.32); overflow: hidden;
    display: grid; grid-template-columns: 248px 1fr; grid-template-rows: minmax(0, 1fr); }

.collector-detail-close { position: absolute; top: 12px; right: 14px; width: 30px; height: 30px; z-index: 3;
    border: 0; border-radius: 8px; background: rgba(52,37,27,.06); color: var(--sb-taupe);
    font-size: 20px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.collector-detail-close:hover { background: rgba(52,37,27,.12); }

/* Identity rail */
.collector-rail { background: linear-gradient(160deg, #3a2a1e, #2b1e15); color: #f4ecdc; padding: 22px 20px;
    display: flex; flex-direction: column; min-height: 0; }
.collector-rail-id { font-size: 10.5px; letter-spacing: .05em; color: var(--sb-gold); margin-top: 5px; }
.collector-rail-name { font-family: var(--sb-serif); font-size: 27px; font-weight: 600; line-height: 1.06;
    margin: 0; color: #f4ecdc; }
.collector-rail-occasions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 9px; font-size: 11.5px; color: #d9c8ad; }
.collector-rail-occasions i { color: var(--sb-gold); margin-right: 4px; }

.collector-rail-actions { display: flex; flex-direction: column; gap: 8px; margin: 18px 0 4px; }
.collector-rail-btn { height: 40px; border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; border: 0; }
.collector-rail-btn.is-primary { background: linear-gradient(135deg, var(--sb-gold), var(--sb-gold-deep));
    color: #2b1e15; box-shadow: 0 5px 14px rgba(156,123,69,.35); }
.collector-rail-btn.is-ghost { background: rgba(244,236,220,.1); color: #f4ecdc; border: 1px solid rgba(244,236,220,.28); }
.collector-rail-btn.is-ghost:hover { background: rgba(244,236,220,.18); }

/* Contacts */
.collector-contacts-toggle { display: none; } /* shown only in portrait */
.collector-rail-contacts { margin-top: 16px; border-top: 1px solid rgba(244,236,220,.14); padding-top: 8px;
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.collector-contact-group { margin-top: 12px; }
.collector-contact-label { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--sb-gold);
    font-weight: 600; margin-bottom: 2px; }
.collector-contact-row { padding: 5px 0; border-top: 1px solid rgba(244,236,220,.1);
    font-size: 12px; color: #f0e6d4; line-height: 1.3; }
.collector-contact-group .collector-contact-row:first-of-type { border-top: 0; }
.collector-contact-val { word-break: break-word; }

/* Certificates body */
.collector-body { padding: 20px 22px; min-height: 0; overflow-y: auto; }
.collector-certs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    margin-bottom: 14px; padding-right: 42px; /* clear the absolute close button */ }
.collector-certs-head h3 { font-family: var(--sb-serif); font-size: 20px; margin: 0; color: var(--sb-ink); }
.collector-certs-cnt { font-size: 11.5px; color: var(--sb-taupe); }
.collectors-empty-sm { color: var(--sb-taupe); font-family: var(--sb-serif); font-size: 17px; padding: 12px 0; }

.collector-certs { display: flex; flex-direction: column; gap: 12px; }
.collector-cert { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--sb-border); border-radius: 13px;
    background: var(--sb-surface-2); transition: border-color .15s ease; }
.collector-cert:hover, .collector-cert:focus-within { border-color: var(--sb-gold); }
.collector-cert-img { width: 70px; height: 70px; object-fit: cover; border-radius: 10px; background: #fff;
    box-shadow: inset 0 0 0 1px var(--sb-border); flex-shrink: 0; }
.collector-cert-body { flex: 1; min-width: 0; }
.collector-cert-desc { font-family: var(--sb-serif); font-size: 16px; line-height: 1.22; color: var(--sb-ink); }
.collector-cert-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px;
    font-size: 11.5px; color: var(--sb-taupe); }
.collector-cert-price { font-weight: 600; color: var(--sb-ink); }
.collector-cert-cta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.collector-cert-view { height: 34px; padding: 0 13px; border: 1px solid var(--sb-border); border-radius: 9px;
    background: var(--sb-surface); color: var(--sb-gold-deep); font-size: 12px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; }
.collector-cert-view:hover { border-color: var(--sb-gold); }
.collector-cert-cta { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 4px;
    font-size: 12px; font-weight: 600; color: var(--sb-gold-deep); text-decoration: none; }
.collector-cert-view i, .collector-cert-cta i { color: var(--sb-gold); }

/* Portrait / phone: stack the rail on top; collapse contacts behind a toggle */
@media (max-width: 720px) {
    .collector-detail { grid-template-columns: 1fr; grid-template-rows: none; height: auto; max-height: none; }
    .collector-rail { padding: 20px; }
    .collector-rail-actions { flex-direction: row; }
    .collector-rail-btn { flex: 1; }
    .collector-contacts-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px;
        background: rgba(244,236,220,.1); color: #f4ecdc; border: 1px solid rgba(244,236,220,.28);
        border-radius: 10px; height: 38px; padding: 0 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
    .collector-contacts-toggle i { transition: transform .15s ease; }
    .collector-rail.contacts-open .collector-contacts-toggle i { transform: rotate(180deg); }
    .collector-rail-contacts { display: none; flex: none; max-height: 40vh; }
    .collector-rail.contacts-open .collector-rail-contacts { display: block; }
    .collector-body { max-height: none; }
}

/* New Collector form modal — simple single-column card on the shared backdrop */
.collector-create { position: relative; width: 100%; max-width: 520px; background: var(--sb-surface);
    border-radius: var(--sb-radius); box-shadow: 0 22px 60px rgba(52,37,27,.32); padding: 22px 24px;
    display: flex; flex-direction: column; gap: 12px; }
.collector-create-head { display: flex; align-items: center; justify-content: space-between; padding-right: 34px; }
.collector-create-title { font-family: var(--sb-serif); font-size: 24px; margin: 0; color: var(--sb-ink); }
