/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: light dark;

  --bg: #fff;
  --bg-muted: #f5f5f5;
  --bg-hover: #fafafa;
  --bg-subtle: #f0f0f0;
  --bg-placeholder: #e0e0e0;
  --bg-badge: #e8e8e8;

  --text: #1a1a1a;
  --text-muted: #555;
  --text-subtle: #666;
  --text-faint: #888;

  --border: #e0e0e0;
  --border-subtle: #f0f0f0;
  --border-input: #ccc;
  --border-focus: #333;

  --header-bg: #111;
  --header-text: #fff;
  --header-muted: #ccc;
  --header-divider: #333;
  --header-sep: #555;

  --button-bg: #111;
  --button-bg-hover: #333;
  --button-text: #fff;
  --button-secondary-bg: #fff;
  --button-secondary-bg-hover: #f5f5f5;
  --button-secondary-text: #111;

  --danger-bg: #c62828;
  --danger-bg-hover: #b71c1c;
  --danger-text: #b71c1c;

  --msg-debug-bg: #f0f0f0;
  --msg-debug-border: #ccc;
  --msg-debug-text: #333;
  --msg-info-bg: #e8f4fd;
  --msg-info-border: #90caf9;
  --msg-info-text: #1565c0;
  --msg-success-bg: #e8f5e9;
  --msg-success-border: #a5d6a7;
  --msg-success-text: #2e7d32;
  --msg-warning-bg: #fff8e1;
  --msg-warning-border: #ffe082;
  --msg-warning-text: #f57f17;
  --msg-error-bg: #fdecea;
  --msg-error-border: #ef9a9a;
  --msg-error-text: #b71c1c;

  --badge-genre-bg: #e3f0ff;
  --badge-genre-text: #1a4f8a;
  --badge-source-bg: #fff8e1;
  --badge-source-text: #7a5c00;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --bg-muted: #1c1c1c;
    --bg-hover: #1e1e1e;
    --bg-subtle: #252525;
    --bg-placeholder: #2a2a2a;
    --bg-badge: #2e2e2e;

    --text: #e8e8e8;
    --text-muted: #b8b8b8;
    --text-subtle: #a0a0a0;
    --text-faint: #888;

    --border: #2a2a2a;
    --border-subtle: #222;
    --border-input: #444;
    --border-focus: #888;

    --header-bg: #0a0a0a;
    --header-text: #fff;
    --header-muted: #aaa;
    --header-divider: #2a2a2a;
    --header-sep: #666;

    --button-bg: #e8e8e8;
    --button-bg-hover: #fff;
    --button-text: #111;
    --button-secondary-bg: #1c1c1c;
    --button-secondary-bg-hover: #252525;
    --button-secondary-text: #e8e8e8;

    --danger-bg: #b71c1c;
    --danger-bg-hover: #c62828;
    --danger-text: #ef9a9a;

    --msg-debug-bg: #252525;
    --msg-debug-border: #444;
    --msg-debug-text: #bbb;
    --msg-info-bg: #14304a;
    --msg-info-border: #2a5580;
    --msg-info-text: #90caf9;
    --msg-success-bg: #1a3d1a;
    --msg-success-border: #2a5d2a;
    --msg-success-text: #a5d6a7;
    --msg-warning-bg: #3d3520;
    --msg-warning-border: #5d5530;
    --msg-warning-text: #ffe082;
    --msg-error-bg: #3d1a1a;
    --msg-error-border: #5d2525;
    --msg-error-text: #ef9a9a;

    --badge-genre-bg: #18324f;
    --badge-genre-text: #90caf9;
    --badge-source-bg: #3a3220;
    --badge-source-text: #ffd54f;
  }
}

:root[data-theme="dark"] {
  --bg: #121212;
  --bg-muted: #1c1c1c;
  --bg-hover: #1e1e1e;
  --bg-subtle: #252525;
  --bg-placeholder: #2a2a2a;
  --bg-badge: #2e2e2e;

  --text: #e8e8e8;
  --text-muted: #b8b8b8;
  --text-subtle: #a0a0a0;
  --text-faint: #888;

  --border: #2a2a2a;
  --border-subtle: #222;
  --border-input: #444;
  --border-focus: #888;

  --header-bg: #0a0a0a;
  --header-text: #fff;
  --header-muted: #aaa;
  --header-divider: #2a2a2a;
  --header-sep: #666;

  --button-bg: #e8e8e8;
  --button-bg-hover: #fff;
  --button-text: #111;
  --button-secondary-bg: #1c1c1c;
  --button-secondary-bg-hover: #252525;
  --button-secondary-text: #e8e8e8;

  --danger-bg: #b71c1c;
  --danger-bg-hover: #c62828;
  --danger-text: #ef9a9a;

  --msg-debug-bg: #252525;
  --msg-debug-border: #444;
  --msg-debug-text: #bbb;
  --msg-info-bg: #14304a;
  --msg-info-border: #2a5580;
  --msg-info-text: #90caf9;
  --msg-success-bg: #1a3d1a;
  --msg-success-border: #2a5d2a;
  --msg-success-text: #a5d6a7;
  --msg-warning-bg: #3d3520;
  --msg-warning-border: #5d5530;
  --msg-warning-text: #ffe082;
  --msg-error-bg: #3d1a1a;
  --msg-error-border: #5d2525;
  --msg-error-text: #ef9a9a;

  --badge-genre-bg: #18324f;
  --badge-genre-text: #90caf9;
  --badge-source-bg: #3a3220;
  --badge-source-text: #ffd54f;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main a {
  color: var(--text);
}

/* Header & Nav */
header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 1.5rem;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.nav-brand {
  color: var(--header-text);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.nav-brand-mark {
  width: 1.4rem;
  height: auto;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--header-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--header-text);
}

/* Language switcher layout */
.nav-langs {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.nav-langs form {
  display: contents;
}

.nav-lang-sep {
  color: var(--header-sep);
  font-size: 0.85rem;
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--header-text);
  border-radius: 1px;
}

@media (max-width: 640px) {
  nav {
    flex-wrap: wrap;
    height: auto;
    min-height: 3.5rem;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0 1rem;
    border-top: 1px solid var(--header-divider);
    margin-top: 0.5rem;
  }

  .nav-links--open {
    display: flex;
  }

  .nav-links > li {
    width: 100%;
  }

  .nav-langs {
    padding-top: 0.5rem;
    border-top: 1px solid var(--header-divider);
    width: 100%;
  }
}

/* Main content */
main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

main h1 {
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
}

main h2 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
}

/* Messages */
.messages {
  max-width: 900px;
  width: 100%;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.message-debug    { background: var(--msg-debug-bg);   border-color: var(--msg-debug-border);   color: var(--msg-debug-text); }
.message-info     { background: var(--msg-info-bg);    border-color: var(--msg-info-border);    color: var(--msg-info-text); }
.message-success  { background: var(--msg-success-bg); border-color: var(--msg-success-border); color: var(--msg-success-text); }
.message-warning  { background: var(--msg-warning-bg); border-color: var(--msg-warning-border); color: var(--msg-warning-text); }
.message-error    { background: var(--msg-error-bg);   border-color: var(--msg-error-border);   color: var(--msg-error-text); }

/* Footer */
footer {
  background: var(--bg-muted);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

footer a {
  color: var(--text);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Forms */
form p {
  margin-bottom: 0.75rem;
}

form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  max-width: 480px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-input);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
}

button[type="submit"]:not(.nav-button):not(.nav-lang):not(.button),
.button {
  display: inline-block;
  background: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: 4px;
  padding: 0.55rem 1.25rem;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  margin-top: 0.5rem;
}

button[type="submit"]:not(.nav-button):not(.nav-lang):not(.button):hover,
.button:hover {
  background: var(--button-bg-hover);
}

button.nav-button,
button.nav-lang {
  display: inline-block;
  background: none;
  color: var(--header-muted);
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s;
}

button.nav-lang {
  font-size: 0.85rem;
}

button.nav-button:hover,
button.nav-lang:hover {
  background: none;
  color: var(--header-text);
}

button.nav-lang--active {
  color: var(--header-text);
  font-weight: 700;
  cursor: default;
}

/* Entity detail */
.entity-header {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.entity-cover {
  width: 200px;
  height: auto;
  border-radius: 4px;
  flex-shrink: 0;
}

.entity-cover--placeholder {
  width: 200px;
  height: 200px;
  background: var(--bg-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.entity-info {
  flex: 1;
}

.entity-badges,
.entity-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.badge {
  display: inline-block;
  background: var(--bg-badge);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}

.badge--genre {
  background: var(--badge-genre-bg);
  color: var(--badge-genre-text);
}

.badge--source {
  background: var(--badge-source-bg);
  color: var(--badge-source-text);
}

.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.5rem;
  margin-top: 0.75rem;
}

.detail-list dt {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.detail-list dd {
  font-size: 0.9rem;
}

.user-item-section {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 1.5rem;
}

.user-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.button--small {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.button--danger {
  background: var(--danger-bg);
  color: #fff;
}

.button--danger:hover {
  background: var(--danger-bg-hover);
}

.button--secondary {
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border: 1px solid var(--border-input);
}

.button--secondary:hover {
  background: var(--button-secondary-bg-hover);
}

@media (max-width: 600px) {
  .entity-header {
    flex-direction: column;
  }

  .entity-cover,
  .entity-cover--placeholder {
    width: 100%;
    height: auto;
    max-width: 200px;
  }
}

/* Collection / browse */
/* type buttons on the left, the "+" add button pushed to the right edge.
   top-align so the button lines up with the first row when type buttons wrap */
.filter-type-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
}

/* square add button, sized to match the type toggle buttons */
.add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1.5px solid var(--border-input);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.add-btn svg {
  display: block;
  width: 20px;
  height: 20px;
}

.add-btn:hover {
  border-color: var(--border-focus);
  background: var(--text);
  color: var(--bg);
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

/* search + sort keep their own inline row below the button rows */
.filter-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-controls input[type="text"] {
  max-width: 180px;
}

/* one row of toggle buttons (type or medium) */
.filter-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-btn {
  position: relative;  /* containing block for the absolutely-positioned radio */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 2.4rem;
  height: 2.2rem;
  padding: 0 0.7rem;
  border: 1.5px solid var(--border-input);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

/* the narrow-by-type script toggles [hidden]; without this, .filter-btn's own
   `display` would override the attribute's default display:none and the button
   would stay visible. The attribute selector out-specifies .filter-btn. */
.filter-btn[hidden] {
  display: none;
}

.filter-btn:hover {
  border-color: var(--border-focus);
}

/* active = filled; invert color so the currentColor SVG and text knock out.
   var(--text)/var(--bg) flip in dark mode, so this inverts correctly there too. */
.filter-btn:has(input:checked) {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* visible focus ring for keyboard users (radio is hidden but focusable) */
.filter-btn:has(input:focus-visible) {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.filter-btn__icon {
  display: block;
}

/* the medium row reads as a sub-filter of the type row above it: a faint rule,
   indented, and a touch smaller than the type buttons */
.filter-buttons--medium {
  padding-top: 0.55rem;
  padding-left: 1.25rem;
  border-top: 1px solid var(--border);
}

.filter-buttons--medium .filter-btn {
  height: 2rem;
  min-width: 2.1rem;
  font-size: 0.8rem;
}

.filter-buttons--medium .filter-btn__icon {
  width: 18px;
  height: 18px;
}

/* hide the native radio WITHOUT removing it from tab/arrow-key order */
.filter-btn input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

/* visually-hidden labels for icon-only buttons (screen readers only) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.collection-table {
  width: 100%;
  border-collapse: collapse;
}

.collection-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  border-bottom: 2px solid var(--border);
  padding: 0.4rem 0.5rem;
}

/* clickable sort headers */
.collection-table th a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.collection-table th a:hover {
  color: var(--text);
}

.collection-table th.is-sorted {
  color: var(--text);
}

.sort-arrow {
  font-size: 0.7em;
  line-height: 1;
}

.empty-cell {
  text-align: center;
  color: var(--text-faint);
  padding: 2rem 1rem;
}

.collection-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.collection-table tr:hover td {
  background: var(--bg-hover);
}

.collection-table a {
  color: var(--text);
  text-decoration: none;
}

.collection-table a:hover {
  font-weight: 600;
}

.col-cover {
  width: 40px;
}

/* Type/Medium table cells: the filter-button glyph without the button chrome */
.cell-glyph {
  color: var(--text-faint);
}

.cell-glyph .filter-btn__icon {
  display: inline-block;
  vertical-align: middle;
}

.table-cover {
  width: 36px;
  height: 36px;
  border-radius: 3px;
  object-fit: cover;
  display: block;
}

.table-cover--placeholder {
  background: var(--bg-placeholder);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-faint);
}

.empty-state p {
  margin-bottom: 1rem;
}

/* Manual add form */
.form-group {
  margin-bottom: 1.25rem;
}

.field-optional {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.field-errors {
  list-style: none;
  margin-top: 0.25rem;
}

.field-error {
  color: var(--danger-text);
  font-size: 0.875rem;
}

.field-help {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-top: 0.25rem;
}

/* Search / add-item page */
.search-form {
  margin-bottom: 1.5rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field--grow {
  flex: 1;
  min-width: 200px;
}

.form-actions {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline;
}

/* Search result cards */
.result-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.result-card:hover {
  background: var(--bg-hover);
}

.result-cover img,
.result-cover--placeholder {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.result-cover--placeholder {
  background: var(--bg-placeholder);
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-title a {
  color: var(--text);
  text-decoration: none;
}

.result-title a:hover {
  text-decoration: underline;
}

.result-creators {
  color: var(--text-subtle);
  font-size: 0.875rem;
}

.result-detail {
  color: var(--text-faint);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.result-meta {
  display: flex;
  gap: 0.4rem;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Barcode scan page */
.scan-viewport {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 60vh;
  max-height: 420px;
  margin: 1rem 0;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.scan-viewport video,
.scan-viewport canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scan-status {
  min-height: 1.5em;
  font-style: italic;
}
.scan-panel {
  margin: 1rem 0;
}
.scan-panel-title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.scan-actions form {
  margin: 0;
}
.scan-cancel {
  margin-top: 0.75rem;
}
.scan-added {
  margin: 0.75rem 0;
  font-weight: 600;
}
.scan-added--error {
  color: #c0392b;
}
/* Scan match card: cover + full-width info on top, actions on their own row,
   so the title/artist aren't crushed into a narrow column on phones. */
.scan-result {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-areas:
    "cover info"
    "actions actions";
  column-gap: 0.75rem;
  row-gap: 0.5rem;
  align-items: start;
}
.scan-result .result-cover { grid-area: cover; }
.scan-result .result-info { grid-area: info; }
.scan-result .scan-actions { grid-area: actions; }
.scan-result .result-title {
  white-space: normal;
  overflow: visible;
}
.scan-hint {
  opacity: 0.8;
}
.scan-manual {
  margin-top: 1rem;
}
.scan-back {
  margin-top: 2rem;
}

.creator-edit { cursor: pointer; }
.creator-edit:hover { text-decoration: underline; }

.creator-name-cell { display: inline-flex; align-items: center; gap: 0.35rem; }
.creator-edit-icon {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: none;
  color: #888;
  cursor: pointer;
}
.creator-edit-icon:hover { color: #6b4e16; }

.badge--override { background: #f5e6c8; color: #6b4e16; }

/* Settings page */
.settings-section {
  margin-bottom: 2rem;
}

/* Column picker */
.column-picker__list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.column-picker__row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
}

.column-picker__move {
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid var(--border-input);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  line-height: 1;
  cursor: pointer;
}

.column-picker__move:hover {
  border-color: var(--border-focus);
}

/* Notes table cell: single-line ellipsis (the sole notes-truncation
   mechanism — the template emits the full note, the title attr keeps it). */
.cell-notes {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

/* Multi-column sort indicators */
.sort-priority {
  font-size: 0.7em;
  vertical-align: super;
  margin-left: 0.15em;
  opacity: 0.7;
}

.sort-reset {
  display: inline-block;
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  opacity: 0.75;
}
.sort-reset:hover {
  opacity: 1;
}

/* PWA install nudge + update banner */
.pwa-install {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 50;
  font: inherit; padding: .55rem 1rem; border: 0; border-radius: .4rem;
  background: var(--button-bg); color: var(--button-text); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.pwa-ios-hint, .pwa-update {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 50;
  display: flex; gap: .75rem; align-items: center; justify-content: space-between;
  padding: .6rem .9rem; border-radius: .4rem;
  background: var(--header-bg); color: var(--header-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.pwa-ios-hint button, .pwa-update button {
  font: inherit; border: 0; border-radius: .3rem; cursor: pointer;
  padding: .35rem .8rem; background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
}
.pwa-ios-hint[hidden], .pwa-update[hidden], .pwa-install[hidden] { display: none; }
