/* Personal and shared collections use the existing cabinet theme tokens. */
body.collections-page { position: static; width: auto; height: auto; min-height: 100vh; overflow: auto; margin: 0; }
.collections-shell { max-width: 1380px; margin: 0 auto; padding: 24px 28px 96px; box-sizing: border-box; }
.collections-shell * { box-sizing: border-box; }
.collections-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 40px; }
.collections-brand { font-size: 24px; font-weight: 750; color: var(--cabinet-text); text-decoration: none; letter-spacing: -.6px; }
.collections-header nav { display: flex; flex-wrap: wrap; gap: 24px; }
.collections-shell a { color: var(--cabinet-accent); }
.collections-header nav a { color: var(--cabinet-muted); text-decoration: none; }
.collections-intro h1 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -1px; margin: 8px 0; }
.collections-intro p { color: var(--cabinet-muted); line-height: 1.5; }
.collections-intro .collections-eyebrow { color: var(--cabinet-accent); font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; }
.collections-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); align-items: start; gap: 24px; margin-top: 18px; }
.collections-layout.collections-shared { grid-template-columns: minmax(0, 1fr); }
.collections-sidebar, .collection-detail, .collection-empty { padding: 24px; border: 1px solid var(--cabinet-border); border-radius: 20px; background: var(--cabinet-surface); box-shadow: var(--cabinet-shadow); min-width: 0; }
.collection-detail .collection-empty { box-shadow: none; background: var(--cabinet-surface-secondary); }
.collection-list { display: grid; gap: 8px; margin-bottom: 24px; }
.collection-list button { width: 100%; text-align: left; padding: 12px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--cabinet-text); cursor: pointer; overflow-wrap: anywhere; }
.collection-list button[aria-current='true'] { background: var(--cabinet-accent-soft); border-color: var(--cabinet-accent); }
.collection-list small { display: block; color: var(--cabinet-muted); margin-top: 4px; }
.collection-form { display: grid; gap: 10px; }
.collection-form label, .collection-search-label, .collection-share-result label { font-size: 13px; font-weight: 600; }
.collection-form input, .collection-form textarea, .collection-search-label input, .collection-share-result input { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid var(--cabinet-border); border-radius: 10px; background: var(--cabinet-surface-secondary); color: var(--cabinet-text); font: inherit; }
.collection-form textarea { resize: vertical; }
.collection-edit > input { font-weight: 650; font-size: 21px; }
.collection-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; min-height: 40px; border: 1px solid var(--cabinet-border); border-radius: 10px; background: var(--cabinet-surface-secondary); color: var(--cabinet-text); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; }
.collection-button.primary { background: var(--cabinet-accent-soft); border-color: var(--cabinet-accent); color: var(--cabinet-accent); }
.collection-button.danger { color: var(--cabinet-danger); }
.collection-button:disabled { opacity: .5; cursor: wait; }
.collection-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.collection-hint, .collection-status { font-size: 13px; color: var(--cabinet-muted); line-height: 1.6; overflow-wrap: anywhere; }
.collection-status { min-height: 21px; margin: 18px 0 0; }
.collection-status.error { color: var(--cabinet-danger); }
.collection-share-panel { margin: 24px 0 30px; padding: 18px; border: 1px solid var(--cabinet-border); border-radius: 14px; background: var(--cabinet-surface-secondary); }
.collection-share-panel h2, .collection-shared-heading h2 { font-size: 18px; margin: 0 0 6px; overflow-wrap: anywhere; }
.collection-share-panel p { font-size: 13px; color: var(--cabinet-muted); }
.collection-share-result { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; margin-top: 14px; }
.collection-share-result label { grid-column: 1 / -1; }
.collection-shared-heading p { white-space: pre-wrap; overflow-wrap: anywhere; }
.collection-section-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 24px 0 14px; }
.collection-section-heading h2 { margin: 0; font-size: 18px; }
.collection-section-heading a { font-size: 13px; }
.collection-section-heading span { color: var(--cabinet-muted); font-size: 13px; font-weight: 400; }
.collection-cars { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.collection-car { background: var(--cabinet-surface-secondary); border: 1px solid var(--cabinet-border); border-radius: 14px; overflow: hidden; min-width: 0; }
.collection-car-gallery { position: relative; }
.collection-car-photos { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.collection-car-photos::-webkit-scrollbar { display: none; }
.collection-car-photo-link { display: block; flex: 0 0 100%; min-width: 0; scroll-snap-align: start; }
.collection-car-photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--cabinet-surface-secondary); }
.collection-photo-nav { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); border: 1px solid var(--cabinet-border); border-radius: 50%; width: 38px; height: 38px; color: var(--cabinet-text); background: var(--cabinet-surface); font: inherit; font-size: 28px; cursor: pointer; }
.collection-photo-nav[data-direction='-1'] { right: auto; left: 10px; }
.collection-photo-counter { position: absolute; bottom: 10px; right: 10px; border-radius: 6px; padding: 4px 7px; background: var(--cabinet-surface); color: var(--cabinet-text); font-size: 12px; pointer-events: none; }
.collection-car-price-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 12px; }
.collection-car-destination { border: 0; padding: 0; background: transparent; color: var(--cabinet-muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.collection-car-content { padding: 14px; }
.collection-car h3 { margin: 0 0 8px; font-size: 18px; overflow-wrap: anywhere; }
.collection-car h3 a { text-decoration: none; color: var(--cabinet-text); }
.collection-car p { color: var(--cabinet-muted); font-size: 13px; }
.collection-car .collection-car-price { margin: 0; font-size: 24px; color: var(--cabinet-text); font-weight: 700; }
.collection-car .collection-toolbar { margin-top: 14px; }
.collection-car .collection-button { padding: 8px 10px; font-size: 12px; }
.collection-comparison-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.collection-switch { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.collection-switch input { accent-color: var(--cabinet-accent); }
.collection-search-label { display: grid; gap: 6px; width: min(320px, 100%); }
.collection-table-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--cabinet-border); border-radius: 14px; }
.collection-table-scroll table { border-spacing: 0; table-layout: fixed; width: max-content; min-width: 100%; font-size: 13px; }
.collection-table-scroll th, .collection-table-scroll td { width: 220px; min-width: 220px; padding: 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--cabinet-border); border-right: 1px solid var(--cabinet-border); overflow-wrap: anywhere; white-space: pre-line; background: var(--cabinet-surface); }
.collection-table-scroll th:first-child { position: sticky; left: 0; z-index: 1; width: 180px; min-width: 180px; background: var(--cabinet-surface-secondary); }
.collection-table-scroll thead th { font-weight: 650; }
.collection-table-scroll tr.collection-row-different td { background: var(--cabinet-accent-soft); }
.collection-table-scroll a { text-decoration: none; }
.collection-table-scroll ul { margin: 0; padding-left: 16px; }
.collection-empty { text-align: center; padding: 40px 24px; }
.collection-empty p { color: var(--cabinet-muted); line-height: 1.6; }
.collections-page [hidden], .collection-picker [hidden] { display: none !important; }
.collections-shell :focus-visible, .collection-picker :focus-visible { outline: 2px solid var(--cabinet-accent); outline-offset: 3px; }
/* Shared add-to-collection dialog on catalogue/detail/favourites. */
.collection-picker, .collection-card-add, .collection-entry-link {
    --cabinet-surface: var(--surface-color);
    --cabinet-surface-secondary: var(--surface-color);
    --cabinet-text: var(--text-primary, inherit);
    --cabinet-muted: var(--text-secondary);
    --cabinet-border: var(--border-color, var(--border-light));
    --cabinet-accent: var(--primary-color, var(--text-secondary));
    --cabinet-accent-soft: var(--border-light, var(--surface-color));
    --cabinet-danger: var(--danger-color, var(--text-secondary));
    --cabinet-shadow: 0 10px 32px var(--shadow-medium, transparent);
}
.collection-picker { color: inherit; }
.collection-picker { width: min(460px, calc(100% - 32px)); max-height: min(80vh, 640px); padding: 24px; border: 1px solid var(--cabinet-border); border-radius: 20px; background: var(--cabinet-surface); color: var(--cabinet-text); box-shadow: var(--cabinet-shadow); font-family: inherit; overflow: auto; }
.collection-picker::backdrop { background: var(--cabinet-muted); opacity: .45; }
.collection-picker h2 { margin: 0; font-size: 21px; }
.collection-picker .collection-list { margin-top: 18px; max-height: 260px; overflow: auto; }
.collection-picker-close { float: right; }
.collection-picker .collection-status { margin: 12px 0; }
.collection-card-add { display: block; margin: 0 14px 14px; width: calc(100% - 28px); background: var(--cabinet-accent-soft); border: 1px solid var(--cabinet-border); color: var(--cabinet-accent); padding: 10px; border-radius: 10px; font: inherit; font-size: 13px; cursor: pointer; }
.collection-entry-link { display: inline-flex; align-items: center; color: var(--cabinet-accent); font-size: 13px; padding: 6px 0; }
body.favorites-page [data-collection-favorites] { color: inherit; background: var(--surface-color); border-color: var(--border-color, var(--border-light)); }
@media (max-width: 768px) {
    .collections-page #home-bottom-nav { background: var(--cabinet-surface-secondary); }
    .collections-shell { padding: 20px 16px 100px; }
    .collections-header { margin-bottom: 28px; gap: 14px; align-items: start; }
    .collections-brand { font-size: 21px; }
    .collections-header nav { gap: 10px; font-size: 12px; justify-content: end; }
    .collections-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .collections-sidebar, .collection-detail { padding: 18px; border-radius: 16px; }
    .collection-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .collection-car-content { padding: 10px; }
    .collection-car .collection-toolbar { gap: 5px; }
    .collection-share-result { grid-template-columns: minmax(0, 1fr) auto; }
    .collection-share-result input { grid-column: 1 / -1; }
    .collection-table-scroll th:first-child { width: 130px; min-width: 130px; font-size: 12px; padding: 12px 10px; }
    .collection-table-scroll td, .collection-table-scroll thead th:not(:first-child) { width: 180px; min-width: 180px; padding: 12px; }
}
@media (max-width: 480px) {
    .collection-edit .collection-toolbar { align-items: stretch; }
    .collection-edit .collection-toolbar button { flex: 1; }
    .collection-car .collection-car-price { font-size: 24px; }
}

@media (min-width: 769px) {
    .collection-cars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1025px) {
    .collections-shared .collection-cars { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
