:root {
  color-scheme: light;
  --sidebar-width: clamp(320px, 18vw, 380px);
  --bg: #f6f3ed;
  --surface: #ffffff;
  --surface-muted: #ece8df;
  --text: #1f2428;
  --muted: #66716e;
  --line: #d9d4c9;
  --accent: #266b5d;
  --accent-strong: #174a40;
  --warn: #9b5b18;
  --shadow: 0 14px 40px rgba(39, 45, 42, 0.12);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #151816;
  --surface: #202822;
  --surface-muted: #2b342d;
  --text: #f3f5ef;
  --muted: #c4cec7;
  --line: #526157;
  --accent: #64b89d;
  --accent-strong: #d9fff1;
  --warn: #ffb36f;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 249, 236, 0.95), transparent 34%),
    linear-gradient(135deg, #f8f4eb 0%, #efe7d8 46%, #e8decc 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.theme-dark {
  background:
    radial-gradient(circle at 18% 12%, rgba(69, 103, 86, 0.42), transparent 34%),
    linear-gradient(135deg, #111411 0%, #1a211c 48%, #252b25 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("assets/guitar-bg.svg");
  background-repeat: no-repeat;
  background-position: right -130px bottom -90px;
  background-size: min(980px, 72vw) auto;
  opacity: 0.42;
}

body.theme-dark::before {
  opacity: 0.18;
}

.library-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: rgba(246, 243, 237, 0.62);
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 700;
  backdrop-filter: blur(2px);
}

body.theme-dark .library-loading-overlay {
  background: rgba(21, 24, 22, 0.68);
}

.library-loading-spinner {
  width: 58px;
  aspect-ratio: 1;
  border: 6px solid rgba(38, 107, 93, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: library-loading-spin 0.85s linear infinite;
}

@keyframes library-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 8px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  padding: 0 0 10px;
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: normal;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
}

.topbar p,
.panel-header span,
.hint,
.stats {
  color: var(--muted);
}

.topbar p {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.2;
}

.hidden-header-status {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.auth-status {
  display: grid;
  gap: 1px;
  margin-top: 4px;
  color: var(--accent-strong);
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.auth-status-line {
  display: block;
}

.auth-status-line:first-child {
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.topbar-actions > * {
  min-width: 0;
}

.auth-link-button {
  display: inline-grid;
  flex: 1 1 120px;
  place-items: center;
  min-height: 36px;
  margin-top: 0;
  max-width: 100%;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  padding: 0 12px;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mobile-qr-button {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcf9;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  padding: 0 9px;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.theme-dark .mobile-qr-button {
  background: var(--surface-muted);
}

.mobile-qr-button:hover {
  border-color: var(--accent);
  background: #f3faf7;
}

body.theme-dark .mobile-qr-button:hover {
  background: #334038;
}

.icon-button {
  flex: 0 0 42px;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 24px;
}

.management-button {
  display: inline-grid;
  flex: 1 1 150px;
  place-items: center;
  min-height: 36px;
  width: 100%;
  max-width: none;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  padding: 0 8px;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: none;
}

.management-button:hover,
.icon-button:hover {
  border-color: var(--accent);
}

.icon-button input,
.secondary-source-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.search-field {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 36px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.keyboard-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 18px;
}

.keyboard-toggle.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.virtual-keyboard {
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
}

body.theme-dark .virtual-keyboard {
  background: rgba(32, 40, 34, 0.96);
}

.keyboard-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
}

.keyboard-key {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.keyboard-key.wide {
  grid-column: span 2;
}

.keyboard-key.extra-wide {
  grid-column: span 4;
}

.search-field span {
  color: var(--accent);
  font-size: 26px;
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.filters {
  display: flex;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.filter-button {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.filter-button:last-child {
  border-right: 0;
}

.filter-button.active {
  background: var(--accent);
  color: white;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, var(--sidebar-width)) 8px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
  min-height: calc(100vh - 16px);
}

.side-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(3px);
}

body.theme-dark .side-panel,
body.theme-dark .results-panel {
  background: rgba(32, 40, 34, 0.96);
}

.side-panel {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 16px);
  padding: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-resizer {
  position: sticky;
  top: 8px;
  z-index: 3;
  align-self: stretch;
  width: 8px;
  max-height: calc(100vh - 16px);
  border-radius: 999px;
  cursor: col-resize;
  touch-action: none;
}

.sidebar-resizer::before {
  content: "";
  display: block;
  width: 3px;
  height: 100%;
  margin: 0 auto;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(38, 107, 93, 0.48) 0,
      rgba(38, 107, 93, 0.48) 8px,
      transparent 8px,
      transparent 15px
    );
}

.sidebar-resizer:hover::before,
.sidebar-resizer:focus-visible::before,
body.resizing-sidebar .sidebar-resizer::before {
  background:
    repeating-linear-gradient(
      to bottom,
      var(--accent) 0,
      var(--accent) 9px,
      transparent 9px,
      transparent 15px
    );
}

body.resizing-sidebar {
  cursor: col-resize;
  user-select: none;
}

.results-panel {
  height: calc(100vh - 16px);
  min-height: calc(100vh - 16px);
  padding: 0;
  overflow: hidden;
}

body.settings-mode .results-panel {
  overflow-y: auto;
  overflow-x: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--warn);
  cursor: pointer;
  padding: 6px 0;
}

.danger-button {
  min-height: 42px;
  width: fit-content;
  border: 1px solid rgba(155, 91, 24, 0.4);
  border-radius: 8px;
  background: #fff6ec;
  color: var(--warn);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 700;
}

.danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stats {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 15px;
}

.library-actions-header {
  margin-top: 12px;
  margin-bottom: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.favorite-lists {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
  padding-bottom: 2px;
}

.favorite-list-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.timed-songs-button,
.share-all-button {
  min-height: 30px;
  max-width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timed-songs-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.share-all-button {
  max-width: 102px;
}

.share-all-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.star-add-button {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: #ad7600;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.favorite-list-menu {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  height: var(--favorite-list-height, 150px);
  min-height: 92px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.favorite-list-resizer {
  position: relative;
  width: 100%;
  height: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: row-resize;
  touch-action: none;
}

.favorite-list-resizer::before {
  content: "";
  position: absolute;
  left: 35%;
  right: 35%;
  top: 4px;
  height: 3px;
  border-radius: 999px;
  background: rgba(38, 107, 93, 0.36);
}

.favorite-list-resizer:hover::before,
.favorite-list-resizer:focus-visible::before,
body.resizing-favorite-list .favorite-list-resizer::before {
  background: var(--accent);
}

body.resizing-favorite-list {
  cursor: row-resize;
  user-select: none;
}

.favorite-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px 42px;
  align-items: center;
  gap: 2px;
}

.favorite-list-item.can-delete {
  grid-template-columns: minmax(0, 1fr) 22px 42px 22px;
}

.favorite-list-item.shared .favorite-list-button {
  grid-column: 1 / -1;
}

.favorite-list-item.system-list .favorite-list-button {
  grid-column: 1 / -1;
}

.favorite-list-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 1px 6px;
  text-align: left;
}

.favorite-list-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-list-button.active {
  background: #f3ead5;
  color: var(--accent-strong);
  font-weight: 700;
}

body.theme-dark .favorite-list-button.active {
  background: #394536;
}

.favorite-list-count {
  color: var(--muted);
  font-size: 12px;
}

.favorite-list-owner {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-list-delete,
.favorite-list-share,
.favorite-list-visibility {
  display: grid;
  place-items: center;
  width: 22px;
  min-height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  line-height: 1;
}

.favorite-list-delete {
  color: var(--warn);
  font-size: 18px;
}

.favorite-list-share {
  width: 42px;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 800;
}

.favorite-list-share.active {
  background: var(--accent);
  color: #fff;
}

.favorite-list-visibility {
  color: var(--accent-strong);
  font-size: 16px;
  position: relative;
}

.favorite-list-visibility.muted {
  color: var(--accent-strong);
  opacity: 1;
}

.favorite-list-visibility.muted::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 50%;
  height: 2px;
  border-radius: 999px;
  background: #c7362f;
  transform: rotate(-35deg);
}

.favorite-list-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.favorite-list-shared-heading {
  margin-top: 4px;
  padding: 4px 6px 1px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.load-folder-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 46px;
  margin-bottom: 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.scroll-controls {
  margin-top: 0;
  display: none !important;
  gap: 6px;
  margin-bottom: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  margin-bottom: 0;
}

.range-label {
  color: var(--muted);
  font-size: 12px;
}

#scrollSpeed {
  width: 100%;
  accent-color: var(--accent);
  min-height: 24px;
}

.scroll-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 4px;
}

.control-button {
  min-height: 34px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
  padding: 0 8px;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.control-button:first-child {
  grid-column: 1 / -1;
}

.scroll-actions .control-button:first-child {
  grid-column: auto;
}

.scroll-end-status {
  min-height: 16px;
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.scroll-end-status.actionable,
.reading-end-status.actionable {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.scroll-end-status.actionable:focus-visible,
.reading-end-status.actionable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.control-button.secondary {
  background: var(--surface);
  color: var(--accent-strong);
}

.hint {
  padding-top: 14px;
  line-height: 1.45;
  font-size: 14px;
}

.empty-state {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 8px;
  place-content: center;
  min-height: 100%;
  padding: 56px 18px;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
}

.empty-state::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.58)),
    url("assets/guitar-bg.svg") center / cover no-repeat;
  opacity: 0.9;
}

.empty-state::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.3) 56%, rgba(255, 255, 255, 0.08));
}

.empty-state strong {
  color: var(--text);
  font-size: 20px;
}

.score-list {
  display: block;
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  list-style: none;
  height: auto;
  max-height: none;
  min-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.settings-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
  background: #fdfcf9;
}

body.theme-dark .settings-view {
  background: var(--surface);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.settings-header h2 {
  font-size: 20px;
}

.settings-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.settings-content {
  display: grid;
  align-content: start;
  gap: 10px;
  max-width: none;
  width: 100%;
  padding: 12px 14px;
}

.settings-section {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h3 {
  margin: 0;
  font-size: 16px;
}

.settings-subtitle {
  margin: 2px 0 0;
  color: var(--accent-strong);
  font-size: 14px;
}

.settings-status {
  margin: 0;
  color: var(--muted);
}

.settings-field {
  display: grid;
  gap: 6px;
}

.settings-field span {
  color: var(--muted);
  font-size: 14px;
}

.settings-field input,
.settings-field textarea {
  min-height: 42px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
}

body.theme-dark .settings-field input,
body.theme-dark .settings-field select,
body.theme-dark .settings-field textarea,
body.theme-dark .user-role-select,
body.theme-dark .secondary-source-button,
body.theme-dark .subscription-toggle {
  background: #18211b;
  color: var(--text);
}

.settings-field textarea {
  min-height: 120px;
  padding: 10px;
  resize: vertical;
  line-height: 1.45;
  font: inherit;
}

.password-input-wrap {
  position: relative;
  display: block;
}

.password-input-wrap input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transform: translateY(-50%);
}

.password-toggle.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 2px;
  border-radius: 999px;
  background: #c7362f;
  transform: rotate(-35deg);
}

.remember-login-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.remember-login-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.role-explainer {
  display: grid;
  gap: 6px;
}

.role-explainer div {
  display: grid;
  gap: 3px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcf9;
}

body.theme-dark .role-explainer div,
body.theme-dark .pricing-benefits div,
body.theme-dark .subscription-summary div,
body.theme-dark .subscription-info-panel,
body.theme-dark .subscription-plan-grid div {
  background: var(--surface-muted);
}

.role-explainer strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.role-explainer span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.settings-field select,
.user-role-select {
  min-height: 42px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
}

.source-actions,
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.settings-actions {
  margin-top: 2px;
}

.delay-measure-tool {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.delay-measure-tool .control-button {
  width: auto;
  min-height: 42px;
  padding-inline: 14px;
  font-size: 14px;
}

.delay-measure-tool span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.source-actions .load-folder-button,
.settings-actions .control-button {
  width: auto;
  margin-bottom: 0;
  padding-inline: 14px;
}

.secondary-source-button {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 700;
}

.upload-progress {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.upload-progress strong {
  color: var(--text);
}

.upload-progress span.active {
  color: var(--accent-strong);
  font-weight: 700;
}

.upload-progress span.error {
  color: var(--warn);
  font-weight: 700;
}

.no-results {
  padding: 18px 0;
  color: var(--muted);
}

.guest-limit-notice {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "message"
    "action";
  align-items: start;
  gap: 8px;
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid rgba(155, 91, 24, 0.35);
  border-radius: 8px;
  background: #fff1dc;
  color: #9b5b18;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.guest-limit-notice span {
  grid-area: message;
}

.guest-limit-notice button {
  grid-area: action;
  justify-self: start;
  width: fit-content;
  min-height: 28px;
  border: 1px solid #9b5b18;
  border-radius: 999px;
  background: #9b5b18;
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 0 12px;
  box-shadow: 0 4px 10px rgba(155, 91, 24, 0.18);
  white-space: nowrap;
}

.guest-limit-notice button:hover {
  background: #7f4812;
}

.pricing-intro {
  color: var(--muted);
  line-height: 1.45;
}

.pricing-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.pricing-benefits div {
  display: grid;
  gap: 3px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcf9;
}

.pricing-benefits strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.pricing-benefits span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.pricing-table-group {
  display: grid;
  gap: 16px;
}

.pricing-table-section {
  display: grid;
  gap: 10px;
}

.pricing-table-section h3 {
  margin: 0;
  font-size: 16px;
}

.pricing-table-wrap {
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pricing-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  background: white;
}

.pricing-table th,
.pricing-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  line-height: 1.25;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.pricing-table th {
  background: #f8f3e8;
  color: var(--accent-strong);
  font-weight: 800;
}

.pricing-table tbody tr:last-child td {
  border-bottom: 0;
}

.pricing-table td:first-child {
  font-weight: 800;
}

.pricing-table th:nth-child(1),
.pricing-table td:nth-child(1) {
  width: 30%;
}

.pricing-table th:nth-child(2),
.pricing-table td:nth-child(2) {
  width: 20%;
}

.pricing-table th:nth-child(3),
.pricing-table td:nth-child(3) {
  width: 25%;
}

.pricing-table th:nth-child(4),
.pricing-table td:nth-child(4) {
  width: 25%;
}

.pricing-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.library-results {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #fdfcf9;
}

body.theme-dark .viewer {
  background: var(--surface);
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.viewer-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.viewer-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.viewer-button.secondary {
  background: var(--surface);
  color: var(--accent-strong);
}

.viewer-button.active {
  background: var(--accent);
  color: white;
}

.icon-viewer-button {
  min-width: 46px;
  padding: 0 12px;
  font-size: 20px;
  line-height: 1;
}

.viewer-header strong,
.viewer-header span {
  display: block;
  overflow-wrap: anywhere;
}

.viewer-header span {
  color: var(--muted);
  font-size: 14px;
}

.viewer-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewer-source-links a {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
  text-decoration: none;
}

.viewer-source-links a:hover {
  border-color: var(--accent);
}

.viewer-measure-button {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
  white-space: nowrap;
}

.viewer-measure-button.secondary {
  background: var(--surface);
  color: var(--accent-strong);
}

.viewer-measure-status {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.doc-link-button {
  display: inline-grid;
  min-height: 42px;
  align-items: center;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  padding: 0 14px;
  text-decoration: none;
}

.doc-link-button.secondary {
  background: white;
  color: var(--accent-strong);
}

.viewer-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #e8e4db;
}

body.theme-dark .viewer-stage {
  background: #101511;
}

.viewer-stage.pdf-pages {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 12px;
  padding: 12px;
  color: var(--muted);
}

.viewer-loading {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  min-height: 100%;
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 800;
}

.viewer-loading-spinner {
  width: 58px;
  aspect-ratio: 1;
  border: 6px solid rgba(38, 107, 93, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: library-loading-spin 0.85s linear infinite;
}

.pdf-page {
  display: block;
  max-width: 100%;
  height: auto;
  background: white;
  box-shadow: 0 1px 8px rgba(31, 36, 40, 0.14);
}

.viewer-load-error {
  margin: 18px;
  padding: 14px;
  border: 1px solid rgba(155, 91, 24, 0.35);
  border-radius: 8px;
  background: #fff6ec;
  color: var(--warn);
  font-weight: 700;
}

.reading-mode {
  --reading-controls-clearance: 96px;
  overflow: hidden;
}

.reading-mode .app-shell {
  padding: 0;
}

.reading-mode .content-grid {
  display: block;
  min-height: 100vh;
}

.reading-mode .side-panel,
.reading-mode .sidebar-resizer,
.reading-mode .empty-state {
  display: none;
}

.reading-mode .results-panel {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}

.reading-mode .viewer {
  height: 100vh;
}

.reading-mode .viewer-header {
  display: none;
}

.reading-mode .viewer-stage {
  height: 100vh;
}

.reading-mode .viewer-stage.pdf-pages {
  gap: 0;
  padding: 0;
}

.reading-mode .viewer-stage.pdf-pages::after {
  content: "";
  display: block;
  width: 1px;
  height: var(--reading-controls-clearance);
}

.reading-mode .viewer-stage::-webkit-scrollbar {
  width: 10px;
}

.floating-back {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  min-width: 112px;
  min-height: 64px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 22px;
  font-weight: 700;
}

.reading-controls {
  position: fixed;
  left: 50%;
  bottom: 5px;
  bottom: calc(5px + env(safe-area-inset-bottom));
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 10px);
  overflow-x: auto;
  padding: 8px;
  border: 1px solid rgba(31, 36, 40, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 24px rgba(31, 36, 40, 0.16);
  transform: translateX(-50%);
}

body.theme-dark .reading-controls {
  background: rgba(32, 40, 34, 0.88);
}

.reading-control-button {
  display: grid;
  place-items: center;
  min-width: 54px;
  height: 54px;
  border: 1px solid rgba(38, 107, 93, 0.28);
  border-radius: 999px;
  background: white;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.reading-control-button.pause {
  min-width: 82px;
  font-size: 15px;
  font-weight: 700;
}

.reading-control-button.small-step {
  min-width: 34px;
  height: 34px;
  font-size: 13px;
  font-weight: 800;
}

.reading-control-button.fit-toggle {
  min-width: 76px;
  padding: 0 14px;
  font-size: 13px;
}

.reading-control-button.fit-toggle.active {
  background: var(--accent);
  color: white;
}

.reading-speed-value {
  min-width: 68px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.reading-end-status {
  min-width: 86px;
  color: var(--warn);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.favorite-picker-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
}

.auth-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
}

.pricing-dialog {
  width: min(520px, calc(100vw - 18px));
}

.mobile-qr-dialog {
  width: min(360px, calc(100vw - 32px));
}

.favorite-picker-dialog::backdrop {
  background: rgba(31, 36, 40, 0.38);
}

.auth-dialog::backdrop {
  background: rgba(31, 36, 40, 0.38);
}

.favorite-picker-dialog form,
.auth-dialog form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.pricing-dialog form {
  gap: 12px;
  padding: 12px;
}

.mobile-qr-content {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.mobile-qr-content img {
  display: block;
  width: min(240px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.mobile-qr-content p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.mobile-qr-content a {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.favorite-picker-options {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.favorite-picker-option {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fdfcf9;
  color: var(--text);
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
}

.favorite-picker-option:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.share-target-suggestions {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.share-target-option {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fdfcf9;
  color: var(--text);
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
}

.share-target-option:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.favorite-picker-empty {
  margin: 0;
  color: var(--muted);
}

.new-favorite-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.new-favorite-list-row input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fdfcf9;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}

.auth-tab:last-child {
  border-right: 0;
}

.auth-tab.active {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.auth-message {
  min-height: 18px;
  color: var(--warn);
  font-size: 13px;
  line-height: 1.35;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row h3 {
  margin: 0;
}

.subscription-dashboard {
  display: grid;
  gap: 14px;
  margin: 10px 0 16px;
}

.admin-page-tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-page-tab {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 800;
}

.admin-page-tab:last-child {
  border-right: 0;
}

.admin-page-tab.active {
  background: var(--accent);
  color: #fff;
}

.admin-create-user-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.4fr) minmax(150px, 1fr) 150px auto;
  gap: 6px;
  align-items: center;
  margin: 10px 0 14px;
}

.admin-create-user-form input,
.admin-create-user-form select {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
}

.subscription-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
}

.subscription-summary div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcf9;
}

.subscription-summary strong {
  font-size: 20px;
  line-height: 1;
}

.subscription-summary span {
  color: var(--muted);
  font-size: 12px;
}

.compact-button {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 13px;
}

.subscription-info-panel {
  display: grid;
  gap: 12px;
  margin: 10px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcf9;
}

.subscription-info-panel[hidden] {
  display: none;
}

.subscription-info-panel h4,
.subscription-info-panel p {
  margin: 0;
}

.subscription-info-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.subscription-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.subscription-plan-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.subscription-plan-grid span {
  color: var(--muted);
  font-size: 13px;
}

.payment-button {
  min-height: 34px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.payment-button.secondary {
  background: white;
  color: var(--accent);
}

.payment-button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.user-management-list {
  display: grid;
  gap: 10px;
}

.user-management-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(42, 34, 20, 0.06);
}

.user-management-row.inactive {
  border-style: dashed;
  opacity: 0.82;
}

.user-management-info {
  display: grid;
  gap: 3px;
}

.user-management-info strong {
  color: var(--accent-strong);
  font-size: 18px;
  line-height: 1.15;
}

.user-management-info span {
  color: var(--muted);
  font-size: 13px;
}

.user-management-metrics {
  display: grid;
  grid-template-columns:
    minmax(88px, 0.75fr)
    minmax(82px, 0.7fr)
    minmax(86px, 0.72fr)
    minmax(64px, 0.52fr)
    minmax(112px, 0.86fr)
    minmax(84px, 0.62fr);
  gap: 4px;
}

.user-management-metrics div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fdfcf9;
}

body.theme-dark .user-management-metrics div {
  background: #252d27;
}

.user-management-metrics span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.user-management-metrics strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-management-metrics .metric-laatste-login strong {
  font-size: 11px;
}

.user-management-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-bottom: 2px;
}

.user-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.user-action-group.type-actions {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f4ed;
}

body.theme-dark .user-action-group.type-actions {
  background: #252d27;
}

.user-management-actions input {
  min-height: 38px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.user-management-actions .user-role-select,
.user-management-actions .user-package-select {
  min-width: 118px;
  max-width: 160px;
}

.user-management-actions .control-button,
.user-management-actions .danger-button,
.user-management-actions .subscription-toggle {
  white-space: nowrap;
}

.subscription-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  background: white;
}

.subscription-toggle input {
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.admin-user-files {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcf9;
}

body.theme-dark .admin-user-files {
  background: #252d27;
}

.admin-user-files-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.admin-user-files-header span {
  color: var(--muted);
  font-size: 13px;
}

.admin-user-file-list {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.admin-user-file-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.admin-user-file-list span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.admin-sharing-list {
  display: grid;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.admin-sharing-list > span {
  color: var(--muted);
  font-size: 13px;
}

.admin-sharing-heading {
  margin: 8px 0 0;
  color: var(--accent-strong);
  font-size: 13px;
}

.profile-sharing-panel {
  display: grid;
  gap: 12px;
}

.profile-sharing-block {
  display: grid;
  gap: 6px;
}

.profile-sharing-block h4 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 14px;
}

.profile-sharing-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.profile-sharing-item strong,
.profile-sharing-item span {
  display: block;
}

.profile-sharing-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.profile-sharing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.promotion-code-panel {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.promotion-code-list {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.promotion-code-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}

.promotion-code-row strong {
  font-family: Consolas, "Courier New", monospace;
}

.promotion-code-row span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promotion-code-row.used {
  opacity: 0.68;
}

.hidden-files-list {
  display: grid;
  gap: 2px;
  max-height: 220px;
  margin-top: 12px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.hidden-files-empty {
  color: var(--muted);
  font-size: 13px;
}

.hidden-file-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 26px;
  padding: 3px 6px;
  border: 0;
  border-radius: 6px;
  background: #f8f5ee;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.hidden-file-open-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(38, 107, 93, 0.25);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.hidden-file-row.missing {
  background: #fff4ed;
  color: var(--warn);
  cursor: not-allowed;
  opacity: 0.78;
}

.hidden-file-row.missing .hidden-file-open-icon {
  border-color: rgba(155, 91, 24, 0.28);
  color: var(--warn);
}

.hidden-file-row:not(:disabled):hover,
.hidden-file-row:not(:disabled):focus-visible {
  outline: 1px solid var(--accent);
  background: #f3ead5;
}

.hidden-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden-file-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hidden-file-row.missing .hidden-file-status {
  color: var(--warn);
}

.new-favorite-list-row .control-button {
  min-height: 42px;
  padding-inline: 14px;
}

.score-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.score-image {
  display: block;
  width: min(100%, 1100px);
  height: auto;
  margin: 0 auto;
  background: white;
}

.score-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 18px 24px;
  align-items: center;
  min-height: 18px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.score-item.can-rename {
  grid-template-columns: 24px minmax(0, 1fr) 18px 24px 24px;
}

.score-item.selected {
  border-radius: 6px;
  background: #f3ead5;
  color: var(--accent-strong);
  font-weight: 700;
}

body.theme-dark .score-item.selected {
  background: #394536;
}

.score-item.guest-upload .score-title {
  color: var(--accent-strong);
  font-style: italic;
}

.score-item.guest-upload .score-title::after {
  content: " eigen upload";
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.score-item.selected .score-favorite-button,
.score-item.selected .score-hide-button,
.score-item.selected .score-rename-button {
  opacity: 1;
}

.score-favorite-button,
.score-hide-button,
.score-rename-button,
.score-timing-indicator {
  grid-column: 1;
  display: grid;
  place-items: center;
  width: 24px;
  min-height: 18px;
  border: 0;
  background: transparent;
  color: #9a9a9a;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.score-favorite-button.active {
  color: #d69a00;
}

.score-hide-button {
  grid-column: 4;
  color: var(--muted);
  font-size: 13px;
  opacity: 0.68;
}

.score-item.can-rename .score-hide-button {
  grid-column: 5;
}

.score-rename-button {
  grid-column: 4;
  color: var(--accent-strong);
  font-size: 13px;
  opacity: 0.72;
}

.score-timing-indicator {
  grid-column: 3;
  width: 18px;
  color: var(--accent-strong);
  font-size: 13px;
}

.score-timing-indicator:disabled {
  cursor: default;
  opacity: 0;
}

.score-timing-indicator:not(:disabled):hover {
  color: var(--warn);
}

.score-hide-button:hover,
.score-rename-button:hover {
  color: var(--warn);
  opacity: 1;
}

.score-select {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 1px 3px;
  text-align: left;
}

.score-select:hover {
  color: var(--accent-strong);
}

.score-select:focus-visible {
  outline: 3px solid rgba(38, 107, 93, 0.35);
  outline-offset: 4px;
}

.score-title {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.1;
}

.score-shared-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(38, 107, 93, 0.28);
  border-radius: 999px;
  background: rgba(38, 107, 93, 0.1);
  color: var(--accent-strong);
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

@media (min-width: 761px) and (max-width: 1400px) {
  :root {
    --sidebar-width: 300px;
  }

  .app-shell {
    padding: 4px;
  }

  .content-grid {
    grid-template-columns: minmax(280px, var(--sidebar-width)) 5px minmax(0, 1fr);
    gap: 4px;
    min-height: calc(100vh - 8px);
  }

  .side-panel {
    top: 4px;
    max-height: calc(100vh - 8px);
    padding: 6px;
  }

  .sidebar-resizer {
    top: 4px;
    max-height: calc(100vh - 8px);
  }

  .results-panel {
    height: calc(100vh - 8px);
    min-height: calc(100vh - 8px);
  }

  .viewer-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 5px 8px;
  }

  .viewer-title-row {
    gap: 8px;
  }

  .viewer-title-row strong {
    max-width: 190px;
  }

  .viewer-title-row > span {
    max-width: 220px;
    font-size: 13px;
    line-height: 1.2;
  }

  .viewer-source-links {
    gap: 5px;
  }

  .viewer-source-links a,
  .viewer-measure-button {
    min-height: 28px;
    padding: 0 9px;
    font-size: 12px;
  }

  .viewer-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
  }

  .viewer-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .viewer-actions .text-button {
    min-height: 34px;
    padding: 0 5px;
    white-space: nowrap;
  }

  .viewer-stage.pdf-pages {
    gap: 8px;
    padding: 8px;
  }

  .reading-controls {
    bottom: 46px;
    bottom: calc(46px + env(safe-area-inset-bottom));
  }

  .reading-mode {
    --reading-controls-clearance: 142px;
  }
}

@media (min-width: 761px) and (max-width: 1400px) and (orientation: landscape) {
  :root {
    --sidebar-width: 285px;
  }

  .score-list {
    height: auto;
    max-height: none;
    min-height: 200px;
  }

  .topbar {
    gap: 5px;
    padding-bottom: 6px;
  }

  .topbar p,
  .auth-status {
    font-size: 11px;
  }

  .search-panel {
    margin-bottom: 6px;
  }

  .favorite-list-menu {
    max-height: 135px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 8px;
  }

  h1 {
    font-size: 25px;
  }

  .content-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .sidebar-resizer {
    display: none;
  }

  .filters {
    width: 100%;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-title-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .mobile-qr-button {
    display: none;
  }

  .filter-button {
    flex: 1 1 0;
    min-width: 0;
  }

  .side-panel {
    position: static;
    max-height: none;
    overflow-y: visible;
    overflow-x: hidden;
  }

  .library-results,
  .score-list {
    flex: 0 0 auto;
  }

  .library-results {
    overflow: visible;
  }

  .score-list {
    max-height: 420px;
  }

  .score-item {
    grid-template-columns: 24px minmax(0, 1fr) 18px 24px;
  }

  .score-item.can-rename {
    grid-template-columns: 24px minmax(0, 1fr) 18px 24px 24px;
  }

  .viewer-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 8px 10px;
  }

  .viewer-title-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  .viewer-title-row strong {
    flex: 0 1 34%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    white-space: nowrap;
  }

  .viewer-title-row > span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1.25;
  }

  .viewer-source-links {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .viewer-source-links a {
    min-height: 28px;
    padding: 0 8px;
    font-size: 12px;
  }

  .viewer-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  .viewer-button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 38px;
    padding: 0 6px;
    font-size: 12px;
  }

  .viewer-actions .text-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 4px;
    font-size: 12px;
    white-space: nowrap;
  }

  .viewer-stage {
    height: 72vh;
  }

  .guest-limit-notice {
    grid-template-columns: 1fr;
  }

  .guest-limit-notice button {
    width: fit-content;
  }

  .admin-create-user-form,
  .promotion-code-row {
    grid-template-columns: 1fr;
  }

  .user-management-metrics,
  .user-management-actions {
    grid-template-columns: 1fr;
  }

  .pricing-benefits {
    grid-template-columns: 1fr;
  }

  .pricing-dialog {
    width: min(480px, calc(100vw - 12px));
  }

  .pricing-dialog form {
    padding: 10px;
  }

  .pricing-table th,
  .pricing-table td {
    padding: 6px 7px;
    font-size: 11px;
  }
}
