:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #000000;
  --muted: #8e8e93;
  --line: #e5e5ea;
  --primary: #007aff;
  --primary-dark: #0056b3;
  --danger: #ff3b30;
  --success-soft: #e5fbe5;
  --wish-soft: #e5f1ff;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #ffffff;
    --muted: #8e8e93;
    --line: #2c2c2e;
    --primary: #0a84ff;
    --primary-dark: #007aff;
    --shadow: none;
  }

  .modal-header-pretty {
    background: var(--card) !important;
  }

  .pin-card {
    background: var(--card) !important;
  }

  .discogs-result-item {
    border-bottom: 1px solid var(--line) !important;
  }

  .collapse-header {
    background: var(--card) !important;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

body {
  min-height: 100vh;
}

.app-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 12px 32px;
}

.app-header {
  background: transparent;
  color: var(--text);
  border-radius: 0;
  padding: 24px 8px 8px;
  box-shadow: none;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.app-header h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.15;
}

.app-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.app-header .btn {
  margin-top: 0;
  width: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.stat-icon {
  font-size: 18px;
  margin-bottom: 4px;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.text-success { color: #10b981; }
.text-danger  { color: #ef4444; }
.text-warning { color: #f59e0b; }

.toolbar-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.toolbar-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.segmented {
  display: flex;
  background: rgba(120, 120, 128, 0.12);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
  margin-bottom: 12px;
}

@media (prefers-color-scheme: dark) {
  .segmented {
    background: rgba(120, 120, 128, 0.24);
  }
}

.seg-btn {
  flex: 1;
  border: 0;
  border-radius: 7px;
  padding: 7px 8px;
  font-weight: 500;
  font-size: 13px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.seg-btn.active {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 1px rgba(0,0,0,0.04);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.search-row input {
  min-width: 0;
}

.filter-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.hidden {
  display: none !important;
}

.filter-grid,
.form-grid {
  display: grid;
  gap: 12px;
}

.filter-actions {
  margin-top: 12px;
}

.record-grid {
  display: grid;
  gap: 10px;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.record-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.record-card:active {
  transform: scale(0.995);
}

.record-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: #eef2f7;
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 14px;
  text-align: center;
  padding: 8px;
}

.record-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.record-cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.record-cover-placeholder-icon {
  font-size: 28px;
  line-height: 1;
}

.record-cover-placeholder-text {
  font-size: 12px;
  font-weight: 700;
}

.record-artist {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 2px;
  line-height: 1.2;
  word-break: break-word;
}

.record-album {
  font-size: 14px;
  color: #334155;
  margin-bottom: 8px;
  line-height: 1.25;
  word-break: break-word;
}

.record-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
  min-height: 34px;
}

.badge-row,
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge-year {
  background: #eef2ff;
  color: #3730a3;
}

.badge-rating {
  background: #fef3c7;
  color: #92400e;
}

.badge-status-sammlung{
    background:#dcfce7;
color:#166534;
    border:1px solid #86efac;
}
.badge-status-wunschliste{
   background:#dbeafe;
color:#1d4ed8;
    border:1px solid #93c5fd;
}
.badge-status-verkauft{
    background:#e5e7eb;
    color:#374151;
    border:1px solid #cbd5e1;
}
.badge-genre {
  background: #eef2f7;
  color: #334155;
}

.empty-state {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.empty-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:active {
  opacity: 0.7;
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-light {
  background: rgba(120, 120, 128, 0.12);
  color: var(--primary);
}

@media (prefers-color-scheme: dark) {
  .btn-light {
    background: rgba(120, 120, 128, 0.24);
    color: var(--primary);
  }
}

.btn-danger {
  background: rgba(255, 59, 48, 0.12);
  color: #ff3b30;
}

.btn-filter {
  min-width: 80px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-left: 2px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: rgba(120, 120, 128, 0.08);
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: background-color 0.15s ease;
  font-family: inherit;
}

@media (prefers-color-scheme: dark) {
  .field input,
  .field select,
  .field textarea {
    background: rgba(120, 120, 128, 0.18);
  }
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--primary);
}

.field-full {
  grid-column: 1 / -1;
}

/* Datenbereich */
.collapse-header {
  width: 100%;
  border: 0;
  background: var(--bg);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}

.collapse-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.collapse-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #e8eefb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.collapse-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.collapse-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.25;
}

.collapse-chevron {
  font-size: 20px;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.collapse-chevron.open {
  transform: rotate(180deg);
}

#dataPanel {
  margin-top: 12px;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.data-action {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 16px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  text-align: center;
  min-height: 92px;
}

.data-action:active {
  transform: scale(0.99);
}

.file-action {
  user-select: none;
}

.data-icon {
  font-size: 22px;
  line-height: 1;
}

.data-text {
  font-size: 14px;
  font-weight: 700;
}

.danger-action {
  background: #fff5f5;
  color: #b91c1c;
}

.data-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal:not(.hidden) .modal-sheet {
  animation: slideUp 0.35s cubic-bezier(0.32, 0.94, 0.6, 1) forwards;
}

.modal:not(.hidden) .modal-backdrop {
  animation: fadeIn 0.25s ease forwards;
}

.modal-sheet {
  position: absolute;
  inset: 0;
  background: var(--bg);
  overflow-y: auto;
  padding: 14px;
}

.modal-header,
.modal-footer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header-pretty {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.modal-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.modal-title-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #e8eefb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.icon-btn {
  border: 0;
  background: var(--line);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.cover-section,
.form-grid,
.modal-footer,
.detail-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.cover-preview,
.detail-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 700;
}

.cover-preview img,
.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-placeholder-box,
.detail-cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.cover-placeholder-icon,
.detail-cover-placeholder-icon {
  font-size: 40px;
  line-height: 1;
}

.cover-placeholder-text,
.detail-cover-placeholder-text {
  font-size: 14px;
  font-weight: 700;
}

.cover-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.footer-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* Detailansicht */
.detail-card {
  display: grid;
  gap: 16px;
}

.detail-artist {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
}

.detail-album {
  font-size: 18px;
  color: #334155;
  margin-top: 4px;
  line-height: 1.25;
}

.detail-info-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.detail-info-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
}

.detail-info-row:last-child {
  border-bottom: 0;
}

.detail-info-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.detail-info-value {
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.96);
  color: white;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 2000;
  max-width: calc(100vw - 32px);
  text-align: center;
}

@media (min-width: 700px) {
  .app-shell {
    padding: 18px 16px 40px;
  }

  .app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
  }

  .app-header .btn {
    width: auto;
    margin-top: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .filter-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .data-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .compact-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .modal-sheet {
    padding: 20px;
  }

  .detail-card {
    grid-template-columns: 300px 1fr;
    align-items: start;
  }
}

/* =========================
   Finalrunde – Mobile / Optik
========================= */

.record-grid {
  gap: 14px;
}

.record-card {
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.record-card:active {
  transform: scale(0.985);
}

.financial-header {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.financial-leading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.financial-heading {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.financial-current {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.financial-current > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.financial-current .financial-value {
  font-size: 16px;
  white-space: nowrap;
}

.financial-chevron {
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  transition: transform 0.18s ease;
}

.financial-header.expanded .financial-chevron {
  transform: rotate(180deg);
}

.financial-header:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
  border-radius: 8px;
}

.financial-grid:not(.hidden) {
  margin-top: 14px;
}

@media (max-width: 700px) {
  .app-header {
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 10px;
  }

  .app-header > div {
    min-width: 0;
  }

  .app-header h1 {
    font-size: 27px;
    letter-spacing: -0.7px;
  }

  .app-header p {
    display: none;
  }

  .app-header .btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 9px 12px;
    font-size: 13px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 8px;
  }

  .stat-card {
    padding: 9px 8px;
    border-radius: 14px;
  }

  .stat-icon {
    font-size: 16px;
    margin-bottom: 3px;
  }

  .stat-label {
    font-size: 10px;
    white-space: nowrap;
    margin-bottom: 0;
  }

  .stat-value {
    font-size: 19px;
    line-height: 1.15;
  }

  .financial-card {
    padding: 12px;
    border-radius: 16px;
    margin-bottom: 8px;
  }

  .financial-header {
    gap: 8px;
  }

  .financial-icon {
    font-size: 21px;
  }

  .financial-title {
    font-size: 14px;
  }

  .financial-subtitle {
    font-size: 10px;
  }

  .financial-current > span {
    font-size: 9px;
  }

  .financial-current .financial-value {
    font-size: 14px;
  }

  .financial-grid:not(.hidden) {
    margin-top: 10px;
    gap: 7px;
  }

  .financial-item {
    padding: 9px 10px;
  }

  .financial-label {
    font-size: 9px;
    letter-spacing: 0.15px;
  }

  .financial-item .financial-value {
    font-size: 15px;
  }

  .toolbar-card {
    padding: 11px;
    border-radius: 16px;
    margin-bottom: 10px;
  }

  .toolbar-title {
    display: none;
  }

  .segmented {
    margin-bottom: 8px;
  }

  .seg-btn {
    padding: 6px 9px;
    font-size: 12px;
  }

  .record-grid {
    gap: 9px;
  }

  .record-card {
    padding: 7px;
    border-radius: 15px;
  }

  .record-cover-wrap {
    border-radius: 10px;
    overflow: hidden;
  }

  .record-card-body {
    padding: 8px 5px 6px;
  }
}

@media (max-width: 360px) {
  .stat-card {
    padding-inline: 5px;
  }

  .stat-label {
    font-size: 9px;
  }

  .financial-leading {
    gap: 7px;
  }

  .financial-current .financial-value {
    font-size: 13px;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 10px 10px calc(28px + env(safe-area-inset-bottom));
  }

  .app-header {
    padding: 18px 4px 8px;
  }

  .app-header h1 {
    font-size: 30px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    padding: 10px 12px;
  }

  .stat-value {
    font-size: 21px;
  }

  .segmented {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .segmented::-webkit-scrollbar {
    display: none;
  }

  .seg-btn {
    flex: 0 0 auto;
    min-height: 36px;
    padding-inline: 11px;
  }

  .search-row input {
    font-size: 16px;
  }

  #recordModal .cover-section {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
  }

  #recordModal .cover-preview {
    width: 120px;
    aspect-ratio: 1;
  }

  #recordModal .cover-actions {
    margin-top: 0;
    flex-direction: column;
    align-items: stretch;
  }

  #recordModal .cover-actions .btn {
    min-height: 42px;
  }

  #recordModal .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #recordModal .field-full {
    grid-column: 1 / -1;
  }

  #recordModal .modal-sheet {
    padding: max(10px, env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  }

  #recordModal .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0 -1px;
    padding: 10px;
    border-radius: 16px 16px 0 0;
    backdrop-filter: blur(16px);
  }

  .backup-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .backup-buttons {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .backup-buttons .btn {
    min-height: 36px;
  }
}

.record-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

#btnClearEmptyFilters {
  margin-top: 16px;
}

.record-cover-wrap {
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, var(--card) 0%, var(--bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.record-card-body {
  padding: 12px 12px 14px;
}

.record-title {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.45em;
}

.record-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.35em;
}

.record-meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.record-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.73rem;
  line-height: 1;
  font-weight: 700;
}

.detail-cover-image,
#detailCover img {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.detail-cover-placeholder {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--card) 0%, var(--bg) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.detail-info-row {
  padding: 12px 0;
  border-bottom: 1px solid #e8edf3;
}

.detail-info-row:last-child {
  border-bottom: 0;
}

.detail-info-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-info-value {
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}

.detail-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.detail-link-btn:hover {
  color: #fff;
  text-decoration: none;
}

.data-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--bg);
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.45;
}

.backup-hint {
  margin-top: 8px;
  font-size: 0.84rem;
  color: #64748b;
}

@media (max-width: 700px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .record-card-body {
    padding: 10px 10px 12px;
  }

  .record-title {
    font-size: 0.92rem;
  }

  .record-subtitle {
    font-size: 0.86rem;
  }

  .record-meta {
    font-size: 0.78rem;
  }

  .badge {
    font-size: 0.68rem;
    padding: 4px 8px;
  }

  .modal-card,
  .detail-modal-card {
    width: min(100%, 100%);
    max-height: calc(100dvh - 18px);
    border-radius: 22px 22px 0 0;
    margin-top: auto;
  }

  .modal-header,
  .modal-footer,
  .detail-modal-header,
  .detail-modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .detail-modal-body,
  .modal-body {
    padding: 16px;
  }
}



/* =========================================================
   Desktop-Optimierung: Cover im Bearbeitungsfenster kleiner
   ========================================================= */

@media (min-width: 980px) {
  /* Modal insgesamt etwas kompakter und besser zentriert */
  #recordModal .modal-sheet {
    max-width: 1100px;
    width: min(1100px, calc(100vw - 48px));
  }

  /* Cover + Formular nebeneinander, aber nicht so riesig */
  #recordModal .modal-body .cover-section {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
    align-items: start;
  }

  /* Cover-Box deutlich kleiner */
  #recordModal .cover-preview {
    width: 280px;
    max-width: 280px;
    aspect-ratio: 1 / 1;
    min-height: auto;
    max-height: 280px;
    margin: 0;
  }

  /* Bild / Platzhalter sauber einpassen */
  #recordModal .cover-preview img,
  #recordModal .cover-preview .cover-placeholder-box {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
  }

  /* Buttons unter dem Cover kompakter */
  #recordModal .cover-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
  }

  /* Formular soll daneben sauber Platz nutzen */
  #recordModal .form-grid {
    margin-top: 0;
  }
}

/* Auf sehr großen Monitoren noch etwas angenehmer */
@media (min-width: 1400px) {
  #recordModal .modal-sheet {
    max-width: 1180px;
  }

  #recordModal .modal-body .cover-section {
    grid-template-columns: 300px 1fr;
  }

  #recordModal .cover-preview {
    width: 300px;
    max-width: 300px;
    max-height: 300px;
  }

.record-card-sold .record-cover{
    filter: grayscale(40%) brightness(0.88);
}

.record-card-sold{
    opacity:.88;
}

.record-card-sold:hover{
    opacity:1;
}

}

/* Filter-Badge */
.filter-badge {
  background: var(--primary);
  color: white;
  border-radius: 99px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  display: inline-block;
  line-height: 1.2;
}

.filter-badge.hidden {
  display: none !important;
}

/* Hervorhebung für die Haupt-ZIP-Buttons */
.highlight-action {
  background: rgba(0, 122, 255, 0.05) !important;
  border: 1px solid rgba(0, 122, 255, 0.15) !important;
}

@media (prefers-color-scheme: dark) {
  .highlight-action {
    background: rgba(10, 132, 255, 0.08) !important;
    border: 1px solid rgba(10, 132, 255, 0.18) !important;
  }
}

/* Financial Card (Discogs Style) */
.financial-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.financial-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.financial-icon {
  font-size: 26px;
  line-height: 1;
}

.financial-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.financial-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.financial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.financial-item {
  background: rgba(120, 120, 128, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
}

@media (prefers-color-scheme: dark) {
  .financial-item {
    background: rgba(120, 120, 128, 0.16);
  }
}

.financial-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.financial-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.value-gain {
  color: #10b981 !important;
}

.value-loss {
  color: #ef4444 !important;
}

@media (max-width: 600px) {
  .financial-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .financial-item:last-child {
    grid-column: 1 / -1;
  }
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.field input[aria-invalid="true"] {
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

/* === Cover-Status-Badge (Overlay oben links auf dem Cover) === */
.record-cover-wrap {
  position: relative;
}

.cover-status-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.cover-status-badge.badge-status-sammlung {
  background: rgba(16, 185, 129, 0.85);
  color: #fff;
}

.cover-status-badge.badge-status-wunschliste {
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
}

.cover-status-badge.badge-status-verkauft {
  background: rgba(245, 158, 11, 0.85);
  color: #fff;
}

/* === Preispillen auf Plattenkarten === */
.price-pills {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.price-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}

.price-pill-buy {
  background: rgba(120, 120, 128, 0.14);
  color: var(--text);
}

.price-pill-market {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

@media (prefers-color-scheme: dark) {
  .price-pill-buy {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
  }
  .price-pill-market {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
  }
}

/* Startansicht: kompakte Kennzahlen und einklappbare Finanzdetails */
.financial-header {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.financial-leading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.financial-heading { display: flex; flex-direction: column; min-width: 0; }
.financial-current { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.financial-current > span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.financial-current .financial-value { font-size: 16px; white-space: nowrap; }
.financial-chevron { color: var(--muted); font-size: 21px; line-height: 1; transition: transform 0.18s ease; }
.financial-header.expanded .financial-chevron { transform: rotate(180deg); }
.financial-header:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; border-radius: 8px; }
.financial-grid:not(.hidden) { margin-top: 14px; }

@media (max-width: 700px) {
  .app-header { align-items: center; flex-wrap: nowrap; gap: 10px; margin-bottom: 10px; }
  .app-header > div { min-width: 0; }
  .app-header h1 { font-size: 27px; letter-spacing: -0.7px; }
  .app-header p { display: none; }
  .app-header .btn { flex: 0 0 auto; min-height: 40px; padding: 9px 12px; font-size: 13px; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-bottom: 8px; }
  .stat-card { padding: 9px 8px; border-radius: 14px; }
  .stat-icon { font-size: 16px; margin-bottom: 3px; }
  .stat-label { font-size: 10px; white-space: nowrap; margin-bottom: 0; }
  .stat-value { font-size: 19px; line-height: 1.15; }
  .financial-card { padding: 12px; border-radius: 16px; margin-bottom: 8px; }
  .financial-header { gap: 8px; }
  .financial-icon { font-size: 21px; }
  .financial-title { font-size: 14px; }
  .financial-subtitle { font-size: 10px; }
  .financial-current > span { font-size: 9px; }
  .financial-current .financial-value { font-size: 14px; }
  .financial-grid:not(.hidden) { margin-top: 10px; gap: 7px; }
  .financial-item { padding: 9px 10px; }
  .financial-label { font-size: 9px; letter-spacing: 0.15px; }
  .financial-item .financial-value { font-size: 15px; }
  .toolbar-card { padding: 11px; border-radius: 16px; margin-bottom: 10px; }
  .toolbar-title { display: none; }
  .segmented { margin-bottom: 8px; }
  .seg-btn { padding: 6px 9px; font-size: 12px; }
  .record-grid { gap: 9px; }
  .record-card { padding: 7px; border-radius: 15px; }
  .record-cover-wrap { border-radius: 10px; overflow: hidden; }
  .record-card-body { padding: 8px 5px 6px; }
}

@media (max-width: 360px) {
  .stat-card { padding-inline: 5px; }
  .stat-label { font-size: 9px; }
  .financial-leading { gap: 7px; }
  .financial-current .financial-value { font-size: 13px; }
}

.data-panel-anchor {
  position: static;
  margin: 0;
  padding: 0;
}

.data-panel-popover {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 72px);
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 900;
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100dvh - 88px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
}

.data-menu-trigger {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
}

.financial-header[aria-expanded="true"] .financial-chevron {
  transform: rotate(180deg);
}

.financial-diff-percent {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 700px) {
  .financial-grid:not(.hidden) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .financial-item:last-child {
    grid-column: auto;
  }

  .financial-label {
    min-height: 2.2em;
    line-height: 1.1;
  }

  .financial-item .financial-value {
    font-size: 12px;
    white-space: nowrap;
  }

  .financial-diff-percent {
    display: none;
  }

  .data-panel-popover {
    top: calc(env(safe-area-inset-top, 0px) + 62px);
    max-height: calc(100dvh - 78px);
  }

  .data-panel-popover .data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* VinylArchiv · visual refresh */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #191b1f;
  --muted: #747982;
  --line: #e5e7eb;
  --primary: #df4b46;
  --primary-dark: #c93b37;
  --danger: #d94747;
  --success-soft: #e8f4ed;
  --wish-soft: #fbeaec;
  --shadow: 0 8px 24px rgba(27, 35, 45, 0.055);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

body {
  background-image: radial-gradient(ellipse at 50% 0, rgba(255,255,255,.88), transparent 48rem);
}

.app-shell {
  max-width: 1080px;
  padding: 18px 22px 52px;
}

.app-header {
  align-items: center;
  padding: 24px 2px 20px;
  margin-bottom: 4px;
}

.app-header h1 {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 32px;
  font-weight: 760;
  letter-spacing: -1.2px;
}

.app-header h1::before {
  content: "";
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #f4f5f7 0 8%, #df4b46 9% 17%, #24262a 18% 20%, transparent 21%), repeating-radial-gradient(circle, #303238 0 1px, #111318 2px 3px, #292b30 4px 5px);
  box-shadow: 0 2px 6px rgba(0,0,0,.22);
}

.app-header p {
  margin: 5px 0 0 39px;
  font-size: 13px;
  letter-spacing: 0;
}

.app-actions { display: flex; align-items: center; gap: 9px; }
.app-actions .btn-primary { min-height: 44px; padding: 0 18px; border-radius: 14px; box-shadow: 0 5px 14px rgba(223,75,70,.2); }
.btn-plus { font-size: 18px; line-height: 1; margin-right: 4px; }
.data-menu-trigger { background: var(--card); border: 1px solid var(--line); color: var(--text); }

.stats-grid { gap: 10px; margin-bottom: 11px; }
.stat-card {
  min-height: 94px;
  padding: 14px 16px;
  border: 1px solid rgba(225,228,232,.85);
  border-radius: 17px;
  box-shadow: var(--shadow);
}
.stat-icon { width: 21px; height: 21px; margin-bottom: 8px; }
.stat-icon svg, .financial-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-total { color: #525b66; }
.icon-collection { color: #398364; }
.icon-wishlist { color: #d85d66; }
.icon-sold { color: #c7823f; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.stat-value { font-size: 23px; line-height: 1.15; letter-spacing: -.5px; }
.text-success { color: #32805d; }
.text-danger { color: #d85d66; }
.text-warning { color: #c7823f; }

.financial-card, .toolbar-card {
  border: 1px solid rgba(225,228,232,.9);
  border-radius: 17px;
  box-shadow: var(--shadow);
}
.financial-card { padding: 13px 16px 14px; margin-bottom: 11px; }
.financial-leading { gap: 9px; }
.financial-icon { width: 21px; height: 21px; color: #bc8744; font-size: 21px; }
.financial-title { font-size: 14px; font-weight: 720; }
.financial-subtitle { font-size: 11px; }
.financial-grid:not(.hidden) { margin-top: 11px; }
.financial-item { padding: 8px 11px; border-radius: 11px; }
.financial-label { font-size: 9px; letter-spacing: .04em; }
.financial-item .financial-value { font-size: 15px; letter-spacing: -.25px; }
.value-gain { color: #32805d !important; }
.value-loss { color: #d94747 !important; }

.toolbar-card { padding: 13px; margin-bottom: 13px; }
.toolbar-title { font-size: 14px; font-weight: 700; margin-bottom: 9px; }
.segmented { padding: 3px; gap: 3px; border-radius: 12px; background: #f0f1f3; margin-bottom: 10px; }
.seg-btn { min-height: 34px; border-radius: 9px; font-size: 12px; font-weight: 600; color: #686d75; }
.seg-btn.active { color: var(--text); box-shadow: 0 2px 8px rgba(25,27,31,.09); }
.search-row { gap: 8px; }
.search-row input { min-height: 42px; border: 1px solid var(--line); border-radius: 12px; background: #f8f9fa; padding-inline: 14px; color: var(--text); }
.btn-filter { min-height: 42px; border-radius: 12px; background: #f0f1f3; color: #3f454e; }
.filter-panel { padding-top: 11px; margin-top: 10px; }

.collection-heading { display: flex; align-items: end; justify-content: space-between; padding: 4px 2px 11px; }
.collection-heading h2 { margin: 0; font-size: 19px; font-weight: 740; letter-spacing: -.45px; }
.collection-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.record-grid { gap: 13px; }
.record-card {
  padding: 8px;
  border: 1px solid rgba(225,228,232,.9);
  border-radius: 17px;
  box-shadow: 0 4px 16px rgba(27,35,45,.045);
  background: var(--card);
}
.record-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(27,35,45,.1); }
.record-cover-wrap { border-radius: 11px; overflow: hidden; }
.record-cover { border: 0; border-radius: 0; margin: 0; }
.record-card-body { padding: 10px 7px 7px; }
.record-title { min-height: auto; font-size: 14px; font-weight: 720; letter-spacing: -.2px; }
.record-subtitle { min-height: auto; margin-top: 3px; font-size: 12px; }
.record-meta { margin-top: 6px; font-size: 11px; }
.cover-status-badge { top: 8px; left: 8px; padding: 4px 9px; font-size: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.price-pill { font-size: 10px; padding: 4px 8px; }
.badge-status-sammlung { background: #e4f2e9; color: #2f7552; border-color: #c6e1d0; }
.badge-status-wunschliste { background: #fbe8ea; color: #bb4d58; border-color: #f3cbd0; }
.badge-status-verkauft { background: #eef0f2; color: #626870; border-color: #d9dde1; }

.empty-state { border-radius: 19px; box-shadow: var(--shadow); }
.btn { min-height: 40px; border-radius: 12px; font-weight: 650; }
.btn-primary { background: var(--primary); }
.btn-primary:active { background: var(--primary-dark); }
.btn-light { color: var(--text); }
.btn-danger { color: var(--danger); }

.data-panel-popover { border-radius: 20px; box-shadow: 0 20px 55px rgba(20,24,30,.22); }
.data-action { border-radius: 14px; background: #f7f8f9; }
.data-note { border-radius: 14px; background: #f5f6f7; }

.modal { display: flex; align-items: center; justify-content: center; }
.modal-backdrop { background: rgba(17,20,25,.48); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-sheet {
  position: relative;
  inset: auto;
  width: min(920px, calc(100vw - 40px));
  max-height: calc(100dvh - 36px);
  margin: 18px auto;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 25px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(0,0,0,.24);
}
.modal-header, .modal-footer, .cover-section, .form-grid, .detail-card { border-radius: 17px; box-shadow: 0 3px 14px rgba(20,24,30,.045); }
.modal-header { padding: 14px 16px; }
.modal-header h2 { font-size: 20px; letter-spacing: -.4px; }
.modal-header p { font-size: 12px; }
.modal-body { gap: 11px; }
.detail-card { padding: 16px; }
.detail-artist { font-size: 26px; letter-spacing: -.7px; }
.detail-album { font-size: 16px; }
.detail-info-row { border-color: var(--line); }
.form-grid { padding: 15px; }
.field input, .field select, .field textarea { border: 1px solid transparent; border-radius: 11px; background: #f4f5f6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 3px rgba(223,75,70,.12); }
.cover-preview { border-radius: 14px; }
.modal-footer { padding: 12px 14px; }

@media (max-width: 700px) {
  .app-shell { padding: 10px 14px calc(30px + env(safe-area-inset-bottom)); }
  .app-header { padding: 11px 1px 14px; margin-bottom: 1px; }
  .app-header h1 { font-size: 24px; gap: 8px; letter-spacing: -.85px; }
  .app-header h1::before { width: 23px; height: 23px; flex-basis: 23px; }
  .app-actions { gap: 7px; }
  .app-actions .btn-primary { min-height: 39px; padding: 0 12px; border-radius: 12px; font-size: 12px; }
  .data-menu-trigger { width: 36px; height: 36px; flex-basis: 36px; }
  .stats-grid { gap: 7px; margin-bottom: 8px; }
  .stat-card { min-height: 76px; padding: 9px 9px; border-radius: 14px; }
  .stat-icon { width: 17px; height: 17px; margin-bottom: 4px; }
  .stat-label { font-size: 9px; }
  .stat-value { font-size: 18px; }
  .financial-card { padding: 10px 11px; margin-bottom: 8px; border-radius: 14px; }
  .financial-grid:not(.hidden) { margin-top: 8px; gap: 5px; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .financial-item { min-width: 0; padding: 7px 7px; border-radius: 9px; }
  .financial-label { min-height: 2.2em; line-height: 1.1; font-size: 8px; letter-spacing: 0; }
  .financial-item .financial-value { font-size: 11px; white-space: nowrap; }
  .financial-diff-percent { display: none; }
  .toolbar-card { padding: 9px; margin-bottom: 10px; border-radius: 14px; }
  .segmented { margin-bottom: 7px; }
  .seg-btn { padding: 5px 7px; font-size: 11px; }
  .search-row input, .btn-filter { min-height: 39px; }
  .collection-heading { padding: 2px 2px 8px; }
  .collection-heading h2 { font-size: 17px; }
  .record-grid { gap: 9px; }
  .record-card { padding: 6px; border-radius: 14px; }
  .record-card-body { padding: 8px 5px 6px; }
  .record-title { font-size: 12px; }
  .record-subtitle { font-size: 11px; }
  .record-meta { font-size: 10px; }
  .price-pill { font-size: 9px; padding: 3px 7px; }
  .modal { align-items: flex-end; }
  .modal-sheet { width: 100%; max-height: 96dvh; margin: 0; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  .modal-header { border-radius: 15px; }
  .modal-footer { border-radius: 14px 14px 0 0; }
  #recordModal .cover-preview { width: 104px; }
  #recordModal .cover-section { grid-template-columns: 104px minmax(0,1fr); gap: 12px; padding: 12px; }
  #recordModal .form-grid { gap: 9px; padding: 11px; }
  #recordModal .field label { font-size: 11px; }
  #recordModal .field input, #recordModal .field select, #recordModal .field textarea { padding: 10px; font-size: 14px; }
}

@media (max-width: 360px) {
  .app-shell { padding-inline: 10px; }
  .app-header h1 { font-size: 22px; }
  .app-actions .btn-primary { padding-inline: 9px; }
  .financial-item .financial-value { font-size: 10px; }
}

@media (min-width: 701px) {
  .record-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111316;
    --card: #1b1e22;
    --text: #f3f4f6;
    --muted: #a0a5ad;
    --line: #30343a;
    --primary: #f06a62;
    --primary-dark: #dd5750;
    --danger: #ff7168;
    --shadow: 0 8px 24px rgba(0,0,0,.18);
  }
  body { background-image: radial-gradient(ellipse at 50% 0, rgba(255,255,255,.035), transparent 45rem); }
  .segmented, .btn-filter, .data-action, .data-note, .search-row input, .field input, .field select, .field textarea { background-color: #24282d; color: var(--text); }
  .stat-card, .financial-card, .toolbar-card, .record-card, .modal-header, .modal-footer, .cover-section, .form-grid, .detail-card { border-color: var(--line); }
  .badge-status-sammlung { background: #22372c; color: #a7d8b9; border-color: #355343; }
  .badge-status-wunschliste { background: #40272b; color: #f0a0a6; border-color: #60383e; }
  .badge-status-verkauft { background: #2d3034; color: #c2c6cb; border-color: #45494e; }
  .data-menu-trigger { background: var(--card); }
  .record-album, .detail-album { color: #c6cad0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.market-search-trigger {
  border: 0;
  padding: 3px 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.market-search-trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (max-width: 700px) {
  .field-label-row { flex-wrap: wrap; }
  .market-search-trigger { font-size: 10px; }
}

/* Mobile usability refinements */
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.record-card:focus-visible { outline: 3px solid rgba(223,75,70,.42); outline-offset: 2px; }

@media (max-width: 700px) {
  .app-shell { padding-inline: 16px; }
  .app-header { gap: 8px; }
  .app-header h1 { white-space: nowrap; }
  .app-actions .btn-primary { min-height: 44px; }
  .data-menu-trigger { width: 42px; height: 42px; flex-basis: 42px; }
  .stat-card { min-height: 82px; padding: 10px 11px; }
  .stat-icon { width: 18px; height: 18px; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 20px; }
  .financial-label { font-size: 9px; min-height: 2em; }
  .financial-item .financial-value { font-size: clamp(10px, 3.2vw, 13px); }
  .toolbar-title { font-size: 14px; }
  .seg-btn { min-height: 40px; font-size: 12px; }
  .search-row { grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
  .search-row input, .btn-filter { min-height: 48px; }
  .search-row input { font-size: 16px; padding-inline: 12px; }
  .btn-filter { min-width: 88px; padding-inline: 14px; }
  .collection-heading h2 { font-size: 19px; }
  .collection-heading p { font-size: 13px; }
  .record-card { padding: 7px; }
  .record-card-body { padding: 9px 6px 7px; }
  .record-title { font-size: 14px; line-height: 1.3; }
  .record-subtitle { font-size: 12px; }
  .record-meta { font-size: 11px; }
  .price-pill { font-size: 10px; padding: 5px 8px; }
}

@media (max-width: 380px) {
  .app-shell { padding-inline: 11px; }
  .app-header h1 { font-size: 20px; }
  .app-actions .btn-primary { padding-inline: 8px; font-size: 11px; }
  .seg-btn { padding-inline: 4px; font-size: 10px; }
}

/* Listen-Kacheln dienen zugleich als Filtersteuerung. */
.stats-grid .stat-card {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.stats-grid .stat-card.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary), var(--shadow);
}

.stats-grid .stat-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.price-pill-rating {
  background: rgba(222, 168, 58, .18);
  color: #8b6415;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .price-pill-rating {
    background: rgba(222, 168, 58, .22);
    color: #efc86f;
  }
}

.duplicate-notice {
  padding: 11px 13px;
  border: 1px solid rgba(196, 135, 24, .28);
  border-radius: 12px;
  background: rgba(244, 183, 64, .12);
  color: #795713;
  font-size: 13px;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  .duplicate-notice {
    border-color: rgba(239, 200, 111, .28);
    background: rgba(222, 168, 58, .12);
    color: #f1d48f;
  }
}

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 0, rgba(223, 75, 70, .09), transparent 34rem),
    var(--bg);
}

.login-card {
  width: min(100%, 410px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .08);
}

.login-record-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 22px;
  border-radius: 50%;
  background: #202124;
  color: #ef5751;
  font-size: 32px;
  box-shadow: inset 0 0 0 6px #34363a, inset 0 0 0 10px #111;
}

.login-eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.login-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 32px;
  letter-spacing: -.7px;
}

.login-description {
  margin: 8px 0 26px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.login-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.login-password {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.login-password:focus-visible {
  outline: 3px solid rgba(0, 122, 255, .24);
  border-color: var(--primary);
}

.login-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.login-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
}

.login-submit:disabled { opacity: .65; }

.login-footnote {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 480px) {
  .login-screen { padding: 18px; }
  .login-card { padding: 28px 23px; border-radius: 22px; }
}
