/* Shared web / WKWebView controls; all layouts must fit a 280px viewport. */
.card[data-card-gallery] { touch-action: pan-y pinch-zoom; }
.card-specs { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attribute-fields .attribute-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 188px; overflow-y: auto; padding: 4px 2px; font-weight: 400; }
.attribute-fields .attribute-options .check { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.attribute-fields .attribute-options input[type=checkbox] { width: 18px; height: 18px; min-height: 0; flex: 0 0 18px; padding: 0; margin: 0; }
.attribute-fields input[type=number] { width: 100%; min-width: 0; padding: 11px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); font: inherit; }
.attribute-fields .attribute-options:has(input[name=processor]) { grid-template-columns: minmax(0, 1fr); }
.attribute-fields fieldset { min-width: 0; padding: 0; border: 0; margin: 0; }
.attribute-fields legend { margin-bottom: 8px; color: var(--label); font-size: 13px; font-weight: 600; }
.search-correction { padding: 12px 16px; border-radius: 16px; background: var(--soft); line-height: 1.6; }
.search-correction a { display: inline-block; }
.favorite-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.favorite-filters .field { flex: 1 1 180px; min-width: 0; margin: 0; }
.favorite-filters input, .favorite-filters select { max-width: 100%; }
.favorite-filters .check { min-height: 44px; align-items: center; }
.collection-manager { margin: 16px 0 24px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.collection-manager summary, .favorite-picker summary, .conversation-search summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.collection-manager summary::before, .favorite-picker summary::before, .conversation-search summary::before { content: '+'; color: var(--brand-dark); }
.collection-manager[open] > summary::before, .favorite-picker[open] > summary::before, .conversation-search[open] > summary::before { content: '−'; }
.collection-edit, .collection-edit-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; min-width: 0; margin: 10px 0; }
.collection-edit { flex: 1; }
.collection-edit .field, .collection-edit > input { flex: 1 1 150px; min-width: 0; margin: 0; }
.favorite-entry { min-width: 0; }
.favorite-picker { padding: 4px 10px; font-size: 13px; }
.favorite-picker form { display: grid; gap: 10px; }
.favorite-picker .check { overflow-wrap: anywhere; }
.message-search { display: flex; gap: 10px; margin: 12px 0; min-width: 0; }
.message-search input { min-width: 0; flex: 1; width: 0; }
.message-search button { flex-shrink: 0; }
.message-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.conversation-search { margin: 8px 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 16px; }
.message-hits { padding: 0; margin: 0; list-style: none; max-height: 220px; overflow-y: auto; }
.message-hits a { display: grid; gap: 5px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.message-hits span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-context { font-size: 13px; padding: 8px; }
.msg.search-hit .msg-body { outline: 2px solid var(--brand-dark); outline-offset: 3px; }
.kinetic .previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.kinetic .previews .preview { width: auto; height: auto; aspect-ratio: auto; min-width: 0; overflow: visible; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.kinetic .preview > img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 15px 15px 0 0; }
.kinetic .preview > .photo-remove { z-index: 2; }
.kinetic .preview .main-label { top: 5px; bottom: auto; left: 5px; right: 34px; width: fit-content; max-width: calc(100% - 39px); padding: 3px 5px; overflow-wrap: anywhere; }
.photo-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 6px; }
.kinetic .preview .photo-tools button, .photo-editor-actions button { position: static; width: auto; height: auto; min-height: 36px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: var(--ink); font-size: 18px; cursor: pointer; }
.photo-tools button:disabled { opacity: .35; cursor: default; }
.media-cover { margin-top: 18px; min-width: 0; padding: 0; border: 0; }
.media-cover legend { margin-bottom: 8px; font-weight: 600; }
.media-cover .segmented { flex-wrap: wrap; }
.media-cover .segmented label { min-width: 0; }
.media-cover p { margin-bottom: 0; }
/* Перетаскивание фото в форме (listing-form.js). Долгое нажатие пальцем не должно
   открывать меню картинки и выделять текст — плитка просто «поднимается» */
.previews > .preview, .photo-edit > .photo-edit-item { cursor: grab; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.previews > .preview > img, .photo-edit > .photo-edit-item > img { pointer-events: none; }
.photo-edit-item label { cursor: pointer; }
.previews > .is-dragging, .photo-edit > .is-dragging { opacity: .3; }
.is-sorting, .is-sorting * { cursor: grabbing; }
.photo-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; overflow: hidden; border-radius: 16px; box-shadow: 0 14px 36px rgba(16, 42, 53, .3); }
.photo-ghost img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-edit-item:has([name=remove_photo]:checked) > img { opacity: .35; }
.notice-photo .notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-editor { width: 560px; max-width: calc(100% - 24px); max-height: calc(100% - 32px); overflow: auto; box-sizing: border-box; margin: auto; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.photo-editor::backdrop { background: #102a3566; backdrop-filter: blur(8px); }
.photo-editor h2 { margin: 0 0 12px; font-size: 20px; }
.photo-editor-canvas { display: block; max-width: 100%; height: auto; margin: auto; border-radius: 12px; touch-action: none; }
.photo-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.photo-editor-actions button { flex: 1; padding: 8px 12px; font-size: 14px; min-height: 44px; }
.photo-editor-slider { display: grid; gap: 5px; margin: 12px 0; font-size: 13px; }
.photo-editor-slider input { width: 100%; padding: 0; accent-color: var(--brand-dark); }
@media (min-width: 901px) {
  .kinetic .compact-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .kinetic .compact-grid .card { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); align-items: start; padding: 5px; }
  .kinetic .compact-grid .card-photo { aspect-ratio: 4 / 3; width: 100%; }
  .kinetic .compact-grid .card-body { padding: 14px 48px 12px 18px; }
  .kinetic .compact-grid .card-title { font-size: 17px; }
  .kinetic .compact-grid .card-specs { white-space: normal; }
}
@media (max-width: 900px) {
  .compact-switch { display: none !important; }
  .favorite-filters .field { flex-basis: calc(50% - 6px); }
  .favorite-filters .field:first-child { flex-basis: 100%; }
  .kinetic .view-switch { flex-wrap: wrap; }
}
@media (max-width: 360px) {
  .kinetic .previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .message-search { gap: 6px; }
  .message-search .btn { padding-inline: 12px; }
}
