.fm-form.telegram-form { display: flex; flex-direction: column; grid-column: 1 / -1; min-width: 0; max-width: 640px; }
.telegram-field, .secret-field, .telegram-notify { display: flex; align-items: center; gap: 12px; min-width: 0; }
.telegram-field { justify-content: space-between; flex-wrap: wrap; }
.telegram-field a { font-size: var(--settings-help-size); }
.secret-field { flex: 1; }
.secret-field input { flex: 1; width: 0; min-width: 0; }
.secret-field button { flex-shrink: 0; }
.telegram-notify .toggle-label { display: flex; align-items: center; justify-content: space-between; flex: 1; }
.telegram-form > input { width: 100%; min-width: 0; box-sizing: border-box; }
.telegram-form button:disabled, .telegram-form input:disabled { opacity: .45; cursor: not-allowed; }
.telegram-notification-row { display: flex; align-items: center; gap: 12px; min-height: 44px; min-width: 0; }
.telegram-notification-row > label:first-child { flex: 1; margin: 0; white-space: nowrap; }
.fm-form select.telegram-template-select { flex: 0 1 100px; width: 100px; min-width: 90px; min-height: 44px; padding: 8px; }
.telegram-notification-row .telegram-switch-target { display: flex; align-items: center; justify-content: flex-end; flex: 0 0 46px; min-height: 44px; margin: 0; cursor: pointer; }
.favorite-cover-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.favorite-cover-control label.row { margin: 0; }
.favorite-cover-control .favorite-cover-add,
.favorite-cover-control .favorite-cover-remove {
  min-height: 44px;
  padding: 9px 12px;
  font-size: var(--settings-help-size);
}
.favorite-cover-control .favorite-cover-remove:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, var(--border)); }
.favorite-cover-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-modal);
}
/* Shared full-width save action for admin settings. */
button.admin-save-pill {
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  margin-top: 16px;
}
.settings-list { display: grid; gap: var(--settings-option-gap); margin-bottom: var(--settings-option-gap); }
.settings-option { min-width: 0; margin-block: var(--settings-option-gap); }
.settings-list .settings-option { margin: 0; }
.settings-option-row { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; font: var(--settings-label-weight) var(--settings-label-size)/var(--settings-line-height) var(--font); color: var(--text); }
.settings-option-row .switch { flex: none; margin: 0; }
.settings-option-row span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.settings-option-main strong,
.settings-option-main small { display: block; }
.settings-option-help { margin: var(--settings-help-gap) 0 0; color: var(--text-secondary); font: var(--settings-help-weight) var(--settings-help-size)/var(--settings-line-height) var(--font); overflow-wrap: anywhere; }
.settings-field-help { margin: var(--settings-help-gap) 0 var(--settings-option-gap); color: var(--text-secondary); font: var(--settings-help-weight) var(--settings-help-size)/var(--settings-line-height) var(--font); overflow-wrap: anywhere; }
.settings-directory { display: grid; gap: 6px; min-width: 0; margin-block: 16px; }
.settings-directory-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.settings-directory-row input { flex: 1; min-width: 0; width: 0; }
.settings-directory-row button { flex: none; }
.admin-view, .settings-sheet {
  font: var(--settings-label-weight) var(--settings-label-size)/var(--settings-line-height) var(--font);
}
.admin-view main {
  max-width: 1180px;
  min-width: 0;
}
.admin-view .admin-section {
  min-width: 0;
  max-width: 100%;
}
.admin-section h2, .settings-sheet > h2 {
  margin-bottom: 20px;
  font-size: var(--settings-heading-size);
  font-weight: var(--settings-heading-weight);
  line-height: var(--settings-line-height);
}
.admin-section h3, .admin-section legend {
  font-size: var(--settings-section-heading-size);
  font-weight: var(--settings-heading-weight);
  line-height: var(--settings-line-height);
}
:is(.admin-section, .settings-sheet) :is(input:not([type="checkbox"]), select, textarea) {
  font: var(--settings-label-weight) var(--settings-input-size)/var(--settings-line-height) var(--font);
}
:is(.admin-section, .settings-sheet) button {
  font: var(--settings-label-weight) var(--settings-button-size)/var(--settings-line-height) var(--font);
}
.settings-sheet .sheet-heading h2 {
  font: var(--settings-heading-weight) var(--settings-sheet-heading-size)/var(--settings-line-height) var(--font);
}
.scraper-setting-row.settings-secret-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--settings-help-gap) var(--space-2);
}
.settings-secret-row > label { margin: 0; }
.settings-secret-row > .scraper-setting-note { grid-column: 1 / -1; margin: 0; }
.dashboard-status { display: flex; align-items: center; gap: 9px; margin: -6px 0 24px; color: var(--text-secondary); font-size: var(--settings-label-size); }
.dashboard-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dashboard-stat {
  position: relative; display: flex; flex-direction: column; justify-content: center;
  min-width: 0; min-height: 108px; padding: 15px 18px; overflow: hidden; isolation: isolate;
  --glass-render: none; --glass-filter: none;
  background: transparent; border-radius: var(--radius-surface);
  border-color: rgba(255, 255, 255, .28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(255, 255, 255, .10), 0 4px 14px rgba(0, 0, 0, .12);
}
/* Clear artwork with a white veil concentrated behind the labels. */
.dashboard-stat::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: linear-gradient(110deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .48) 42%, rgba(255, 255, 255, 0) 85%);
  box-shadow: inset 1px 0 1px rgba(255, 255, 255, .22), inset -1px 0 1px rgba(255, 255, 255, .12);
}
.dashboard-stat-art { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.dashboard-stat-art:not([src]) { visibility: hidden; }
.dashboard-stat > span, .dashboard-stat strong, .dashboard-stat small {
  width: fit-content; max-width: 100%; color: #172435;
  text-shadow: 0 1px 1px rgba(255, 255, 255, .55);
}
.dashboard-stat > span { font-size: var(--settings-help-size); }
.dashboard-stat strong { margin-top: 4px; font-size: clamp(21px, 2.5vw, 28px); font-weight: 650; line-height: 1.2; }
.dashboard-stat small { margin-top: 4px; font-size: var(--settings-help-size); }
.dashboard-playing, .dashboard-tasks, .dashboard-activity { margin-top: var(--space-4); }
.dashboard-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; list-style: none; }
.dashboard-section-heading::-webkit-details-marker { display: none; }
.dashboard-section-heading h3 { flex: 1; margin: 0; font-size: var(--settings-input-size); }
.dashboard-section-heading:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.dashboard-chevron { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--text-secondary); stroke-width: 1.6; }
[open] > .dashboard-section-heading { margin-bottom: 10px; }
[open] > .dashboard-section-heading .dashboard-chevron { transform: rotate(180deg); }
.task-progress-card { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-rows: auto minmax(32px, auto) 5px; align-items: center; column-gap: 10px; row-gap: 7px; min-width: 0; min-height: 98px; box-sizing: border-box; padding: 13px; margin-bottom: 10px; }
.task-progress-icon { grid-column: 1; grid-row: 1 / 3; align-self: start; color: var(--text-secondary); }
.task-progress-icon .fm-icon { width: 24px; height: 24px; }
.task-progress-title { grid-column: 2; grid-row: 1; min-width: 0; font-size: var(--settings-label-size); font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.task-progress-percent { grid-column: 3; grid-row: 1; justify-self: end; }
.task-progress-meta { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; gap: 2px 4px; min-width: 0; }
.task-progress-card small { font-size: var(--settings-help-size); line-height: 1.4; color: var(--text-secondary); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.task-progress-actions { grid-column: 3; grid-row: 2; display: flex; flex-wrap: nowrap; gap: 6px; }
.task-progress-card progress { grid-column: 2 / 4; grid-row: 3; appearance: none; width: 100%; min-width: 0; height: 5px; border: 0; border-radius: 3px; overflow: hidden; background: var(--border); accent-color: var(--accent); }
.task-progress-card progress::-webkit-progress-bar { background: var(--border); border-radius: 3px; }
.task-progress-card progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
.task-progress-card progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
.dashboard-playing-card { display: flex; gap: 18px; min-width: 0; padding: 13px; margin-bottom: 10px; }
.dashboard-playing-poster { width: 88px; height: 130px; flex: none; object-fit: cover; border-radius: 10px; background: var(--media-surface); }
.dashboard-playing-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.dashboard-playing-main strong { font-size: var(--settings-input-size); }
.dashboard-playing-main small { color: var(--text-secondary); }
.dashboard-playing-progress { display: flex; justify-content: space-between; gap: 10px; margin-top: auto; font-size: 12px; color: var(--text-secondary); }
.dashboard-playing-main progress { width: 100%; height: 5px; accent-color: var(--accent); }
.dashboard-activity ol { list-style: none; padding: 0; margin: 0; }
.dashboard-activity-item { display: flex; align-items: center; gap: 12px; min-height: 46px; border-bottom: 1px solid var(--border); font-size: var(--settings-help-size); }
.dashboard-activity-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--success); }
.dashboard-activity-item div { flex: 1; min-width: 0; }
.dashboard-activity-item span:not(.dashboard-activity-dot), .dashboard-activity-item time { color: var(--text-secondary); }
.dashboard-empty { margin: 0; padding: 16px; text-align: center; background: var(--surface-2); border-radius: var(--radius-surface); }
.confirmation-option { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 44px; }
@media (max-width: 650px) { .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashboard-stat { min-height: 96px; padding: 13px; } .dashboard-playing-card { gap: 12px; } .dashboard-playing-poster { width: 68px; height: 102px; } }
.admin-section .row, .admin-section .settings-row,
.settings-sheet .row, .settings-sheet label,
.admin-section .toggle-label, .admin-section .settings-option-row,
.admin-section .tmdb-field, .admin-section label,
.admin-section .settings-directory > label, .admin-section .settings-option-main strong,
.admin-section .row .info > strong, .admin-section .settings-row strong {
  font: var(--settings-label-weight) var(--settings-label-size)/var(--settings-line-height) var(--font);
  color: var(--text);
}
.admin-section p, .admin-section small, .admin-section .tmdb-help,
.settings-sheet p, .settings-sheet small,
.admin-section .row .info p {
  font: var(--settings-help-weight) var(--settings-help-size)/var(--settings-line-height) var(--font);
  color: var(--text-secondary);
}
.admin-section p:where(:not(.settings-option-help, .settings-field-help, .tmdb-help)),
.settings-sheet p:where(:not(.settings-option-help, .settings-field-help, .tmdb-help)) { margin-block: var(--settings-help-gap) var(--settings-option-gap); }
.admin-section form, .admin-section fieldset,
.admin-section .tmdb-settings-form, .admin-section .fm-form {
  min-width: 0;
  max-width: 100%;
}
/* User summaries and device history reuse the existing card tokens. */
.access-group-tag { display: inline-block; max-width: 100%; vertical-align: middle; margin-inline-start: var(--space-2); padding: var(--space-1) var(--space-2); border-radius: var(--radius-button); background: var(--surface-2); color: var(--text-secondary); font-size: var(--settings-help-size); overflow-wrap: anywhere; }
.access-device-list { display: grid; gap: var(--space-3); min-width: 0; }
.access-device-content { grid-column: 2 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); min-width: 0; overflow-wrap: anywhere; }
.access-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-3); }
.access-detail dt { color: var(--text-secondary); }
.access-detail dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.access-device-card .text-button { white-space: normal; text-align: left; overflow-wrap: anywhere; }
.access-device-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-3); padding: var(--space-4); align-items: center; }
.access-device-card > .fm-icon, .access-device-card > .text-button, .access-device-card > [data-device-remove] { grid-row: 1; }
.access-device-card > [data-device-remove] { grid-column: 3; }
.access-device-user { display: flex; align-items: center; gap: var(--space-3); margin-block: var(--space-4); min-width: 0; overflow-wrap: anywhere; }
.access-device-user > div { min-width: 0; }
.access-device-user > .account-menu-avatar { flex-shrink: 0; }
.fm-form {
  min-width: 0;
  max-width: 100%;
}
.admin-section input:not([type="checkbox"]),
.admin-section select, .admin-section textarea {
  min-width: 0;
  max-width: 100%;
  font-size: var(--settings-input-size);
}
.admin-view button, .admin-view summary,
.admin-view .toggle-label, .admin-view input.switch {
  touch-action: manipulation;
}
.admin-view .toggle-label {
  min-height: 44px;
  min-width: 0;
}
.admin-section summary:not(.dashboard-section-heading):not(.icon-button) {
  min-height: 44px;
  padding: 14px;
  touch-action: manipulation;
  background: var(--surface-2);
  border-radius: 12px;
  margin: 12px 0;
}
.admin-section details > details {
  margin-left: 12px;
}
#hamburger {
  background: transparent;
  padding: 8px;
  touch-action: manipulation;
}
#hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  margin: 5px 0;
  background: var(--text);
  transform-origin: center;
  transition: transform var(--motion), opacity var(--motion);
}
#hamburger[aria-expanded="true"] span:first-child { transform: translateY(7px) rotate(45deg); }
#hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
#hamburger[aria-expanded="true"] span:last-child { transform: translateY(-7px) rotate(-45deg); }
#drawer-backdrop {
  position: fixed;
  z-index: 6;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--sheet-backdrop);
  backdrop-filter: var(--drawer-backdrop-blur, var(--sheet-backdrop-blur));
  -webkit-backdrop-filter: var(--drawer-backdrop-blur, var(--sheet-backdrop-blur));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0,2px,0);
  transition: transform var(--sheet-duration) var(--sheet-ease), opacity var(--sheet-duration) var(--sheet-ease), visibility var(--sheet-duration);
}
#drawer {
  touch-action: pan-y;
  position: fixed;
  z-index: 7;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(320px, 86vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(70px, calc(env(safe-area-inset-top) + 58px)) 8px max(12px, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0 24px 24px 0;
  opacity: 0;
  transform: translate3d(-100%,0,0);
  visibility: hidden;
  transition: transform var(--sheet-duration) var(--sheet-ease), opacity var(--sheet-duration) var(--sheet-ease), visibility var(--sheet-duration);
}
#drawer.is-dragging { transition: none; }
#drawer button {
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 0 14px;
  border-radius: 9px;
  text-align: left;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--settings-label-size, 15px);
  font-weight: 500;
  touch-action: pan-y;
}
#drawer svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.drawer-submenu > summary[aria-current="location"] { color: var(--accent); }
.drawer-open #drawer { opacity: 1; transform: translate3d(0,0,0); visibility: visible; }
.drawer-open #drawer-backdrop { transform: translate3d(0,0,0); opacity: 1; visibility: visible; pointer-events: auto; }
html:has(body.drawer-open), body.drawer-open { overflow: hidden; }
body.drawer-open > header { z-index: 8; background: transparent; border-color: transparent; pointer-events: none; }
body.drawer-open > header > :not(#hamburger) { visibility: hidden; }
body.drawer-open #hamburger { pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  #drawer, #drawer-backdrop { transition: none; }
}
.fm-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.fm-toolbar h2 {
  flex: 1;
  margin: 0;
}
.fm-list {
  border: 1px solid var(--border);
  border-radius: 16px;
}
.fm-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.fm-row:not(.fm-row--library) { min-height: 66px; }
.fm-row.ui-choice { border-bottom-color: transparent; }
.fm-row:last-child {
  border-bottom: 0;
}
.admin-section:has(> .fm-list--libraries) { padding: 0; border: 0; background: transparent; box-shadow: none; scroll-margin-top: calc(86px + env(safe-area-inset-top)); }
.admin-section:has(> .fm-list--libraries) > .section-heading { position: static; margin: 0 0 12px; padding-top: 0; }
.admin-section:has(> .fm-list--libraries) > .section-heading h2 { margin: 0; }
.library-toolbar { gap: 8px; padding: 8px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); }
.library-toolbar .toolbar-actions { gap: 4px; margin-left: auto; flex-wrap: wrap; }
.library-toolbar .scan-circle { flex: none; width: 36px; height: 36px; }
.library-toolbar .library-settings-status { margin: 0 8px; font-size: var(--settings-help-size); }
.fm-list--libraries { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; border: 0; border-radius: 0; }
.fm-row--library { position: relative; isolation: isolate; min-width: 0; aspect-ratio: 2.35 / 1; overflow: hidden; box-sizing: border-box; align-items: flex-end; gap: 8px; padding: 18px; color: #fff; background: linear-gradient(135deg, #52697c, #323049 60%, #202d40); border: 0; border-radius: 26px; box-shadow: 0 6px 20px rgba(0,0,0,.10); transition: transform 160ms ease; }
.fm-row--library:active { transform: scale(.985); }
.library-art { position: absolute; z-index: -1; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.library-art img { width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: 0; transition: opacity 160ms ease; }
.library-art img.is-loaded { opacity: 1; }
.library-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, var(--library-art-sheen), transparent 65%), linear-gradient(180deg, transparent 35%, rgba(0,0,0,.15) 60%, rgba(0,0,0,.78) 100%); }
.fm-row--library .fm-name { display: grid; gap: 6px; min-width: 0; color: #fff; pointer-events: none; }
.fm-row--library .library-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 22px; font-weight: 650; letter-spacing: -.5px; }
.fm-row--library .fm-name .library-open { min-width: 0; min-height: 0; max-width: 100%; line-height: 1.2; color: #fff; pointer-events: auto; text-align: left; }
.fm-row--library .library-open { flex: 1; }
.library-open::after { content: ""; position: absolute; inset: 0; border-radius: 26px; }
.library-title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.library-title .hidden-indicator { position: relative; z-index: 1; pointer-events: auto; }
.fm-row--library .fm-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: rgba(255,255,255,.85); line-height: 1.5; }
.library-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-row--library .library-path { display: none; }
.library-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; flex: none; }
.fm-row--library .library-status { display: inline-flex; align-items: center; gap: 4px; flex: none; max-width: 76px; width: auto; text-align: center; font-size: 12px; }
.library-status-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; }
.fm-row--library .library-status-label { overflow: hidden; text-overflow: ellipsis; color: #fff; font-size: 12px; white-space: nowrap; }
.fm-row--library .fm-menu { flex: none; }
.fm-row--library :is(button.secondary, summary).icon-button { color: #fff; }
@media (min-width: 700px) { .fm-list--libraries { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .fm-list--libraries { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 699px) { .admin-view main:has(.fm-list--libraries) { padding-top: 16px; padding-inline: 16px; } .fm-row--library { aspect-ratio: 2.50 / 1; } }
@media (max-width: 600px) { .library-toolbar .library-settings-status { flex-basis: 100%; margin-bottom: 2px; } .library-toolbar .toolbar-actions { margin-left: 0; flex: 1; } }
@media (prefers-reduced-motion: reduce) { .fm-row--library, .library-art img { transition: none; } .fm-row--library:active { transform: none; } }

.fm-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--text-secondary);
}
.icon-button .fm-icon { color: inherit; }
.fm-icon svg {
  width: 100%;
  height: 100%;
}
.fm-name {
  flex: 1;
  min-width: 0;
  font-size: var(--settings-input-size);
  overflow-wrap: anywhere;
}
.fm-name button:not(.hidden-indicator) {
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: var(--settings-input-size);
}
.fm-name small {
  display: block;
  font-size: var(--settings-help-size);
}
.library-hidden:not(.library-name-revealed) .library-name {
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
}
:where(.library-hidden) .hidden-indicator {
  display: inline-flex;
  background: transparent;
  text-align: center;
  font-size: var(--settings-input-size);
  font-weight: 400;
  line-height: var(--settings-line-height);
  color: var(--text-secondary);
  margin-left: var(--space-2);
  vertical-align: middle;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
}
.hidden-indicator:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}
.hidden-indicator:active {
  opacity: 0.65;
}
.hidden-indicator .fm-icon {
  width: 20px;
  height: 20px;
}
.schedule-options {
  grid-column: 1/-1;
}
.schedule-options .segmented {
  display: flex;
}
.schedule-options button {
  flex: 1;
  min-width: 0;
}
.fm-login {
  font-size: var(--settings-help-size);
  color: var(--text-secondary);
}
.fm-menu {
  position: relative;
}
.fm-pop:not([popover]) { position: absolute; right: 0; top: 44px; }
.fm-menu summary {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 12px;
  margin: 0;
  background: transparent;
  list-style: none;
}
.fm-menu summary .fm-icon { width: 20px; height: 20px; }
.fm-menu summary::-webkit-details-marker {
  display: none;
}
.fm-pop {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  width: 210px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  padding: 6px;
}
.fm-pop button {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  gap: var(--space-3);
  background: transparent;
  color: var(--text);
}
.fm-pop button.danger { color: var(--danger); }
@media (max-width: 600px) {
  .fm-pop {
    max-height: min(60dvh, calc(100dvh - 140px - env(safe-area-inset-bottom)));
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y pinch-zoom;
  }
  .fm-pop, .fm-pop * {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
  }
}
.poster-delete { color: var(--danger); }
.library-status {
  font-size: var(--settings-help-size);
  color: var(--text-secondary);
}
.library-status.ready {
  color: var(--success);
}
.scan-circle {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--pct, 0%), var(--surface-2) 0);
  position: relative;
  font-size: var(--settings-help-size);
}
.scan-circle[data-task-state="error"] { color: var(--danger); }
.scan-circle:before {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--surface);
  border-radius: 50%;
}
.scan-circle span {
  z-index: 1;
}
.scan-circle small { position: absolute; top: 100%; white-space: nowrap; font-size: 10px; color: var(--text-secondary); }
.fm-form {
  display: grid;
  grid-template-columns: var(--form-columns, repeat(2, minmax(0, 1fr)));
  gap: var(--settings-option-gap);
}
.fm-form > label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: var(--settings-label-weight) var(--settings-label-size)/var(--settings-line-height) var(--font);
}
.fm-form > label:only-of-type,
.fm-form > #library-paths,
.fm-form > .bar,
.fm-form > .toggle-label,
.fm-form > p {
  grid-column: 1/-1;
}
.fm-form input:not([type="checkbox"]),
.fm-form select {
  width: 100%;
}
.fm-form > .toggle-label {
  flex-direction: row;
}
.form-actions {
  justify-content: flex-end;
}
.form-actions--selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  width: 100%;
}
.form-actions--selection .action-spinner { grid-column: 1 / -1; }
.form-actions--paired {
  width: min(100%, 320px);
  margin-left: auto;
  flex-wrap: nowrap;
}
.form-actions--paired > button {
  flex: 1;
  min-width: 0;
}
.folder-path {
  display: flex;
  align-items: center;
  gap: 12px;
}
.folder-path span {
  overflow-wrap: anywhere;
}
.remove-folder {
  background: transparent;
  color: var(--danger);
}
#library-paths {
  display: grid;
  gap: 12px;
}
#library-paths > .row {
  padding: 12px;
  background: var(--surface-2);
  border-radius: 12px;
  flex-wrap: nowrap;
}
#library-paths input {
  flex: 1;
  width: 0;
}
#fm-picker {
  width: min(580px, calc(100vw - 24px));
  height: min(680px, 85dvh);
}
#fm-picker[open] {
  display: flex;
  flex-direction: column;
}
.picker-path {
  overflow-wrap: anywhere;
  font-size: var(--settings-help-size);
}
.directory-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 350px;
  overflow: auto;
}
#fm-picker .directory-list {
  flex: 1;
  min-height: 0;
  max-height: none;
}
.directory-list button {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  flex-shrink: 0;
}
.directory-list svg {
  width: 22px;
  height: 22px;
}
#fm-picker .directory-unavailable .scraper-directory-text {
  color: var(--text-secondary);
  opacity: .55;
}
.picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
#fm-select {
  flex: 1;
}
.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.inline-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
#logs {
  box-sizing: border-box;
  width: min(940px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: min(720px, 88dvh);
  overflow: hidden;
}
#logs[open] {
  display: flex;
  flex-direction: column;
}
#log-status {
  flex-shrink: 0;
}
.log-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.log-tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 6px;
  flex-wrap: wrap;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding-bottom: var(--space-3);
  -webkit-overflow-scrolling: touch;
}

.log-tabs button {
  background: transparent;
  color: var(--text);
  font-size: var(--settings-label-size);
  padding: 8px 12px;
}
.log-tabs .log-tab {
  flex: 0 0 auto;
  white-space: nowrap;
}
.log-actions {
  display: flex;
  gap: 6px;
}
#log-content {
  width: 100%;
  min-width: 0;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
}
.log-entry {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
  word-break: break-word;
  user-select: text;
}
.log-entry p,
.log-entry pre {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.log-entry progress {
  width: 100%;
  accent-color: var(--accent);
}
.log-head {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.log-entry pre {
  white-space: pre-wrap;
  font-size: var(--settings-help-size);
}
.log-error {
  color: var(--danger);
}
@media (max-width: 600px) {
  .fm-form {
    grid-template-columns: 1fr;
  }
  .fm-form > label {
    grid-column: 1/-1;
  }
  .fm-login {
    display: none;
  }
  .fm-row:not(.fm-row--library) {
    padding: 12px;
    gap: 10px;
  }
  .fm-toolbar select {
    max-width: 100%;
  }
  .form-actions button {
    flex: 1;
  }
  .form-actions button.icon-button {
    flex: none;
  }
  #library-paths > .row {
    flex-wrap: wrap;
  }
  #library-paths input {
    flex-basis: 100%;
    width: 100%;
  }
  .admin-view, .admin-view #app, .admin-view main, .admin-view .admin-section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .admin-view main {
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }
  .admin-view > header {
    gap: 4px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .admin-view > header nav { gap: 0; }
  .admin-view > header .logo { max-width: min(25vw, 100px); }
  .admin-section .row .info, .admin-section .settings-row > span {
    min-width: 0;
  }
  .admin-section .form, .admin-section .bar,
  .admin-section .fm-form, .admin-section .tmdb-settings-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .admin-section .form input:not([type="checkbox"]),
  .admin-section .bar input:not([type="checkbox"]) {
    min-width: 0;
  }
  .admin-view input:not([type="checkbox"]),
  .admin-view select, .admin-view textarea,
  .admin-view dialog input:not([type="checkbox"]),
  .admin-view dialog select, .admin-view dialog textarea {
    font-size: var(--settings-input-size);
  }
  #logs {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    height: min(86dvh, 760px);
    max-height: 86dvh;
    margin: auto;
    padding: 16px;
  }
  .log-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }
  .log-tabs {
    flex-wrap: nowrap;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }
  .log-actions {
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;
    flex: 0 0 auto;
  }
  #log-status {
    margin: 10px 0;
    font-size: var(--settings-help-size);
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
}

.drawer-submenu {
  margin-bottom: 8px;
}

.drawer-submenu > summary {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-button);
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  gap: 10px;
  touch-action: pan-y;
}
.drawer-submenu > summary span { flex: 1; }
.drawer-submenu > summary small { display: block; font-size: var(--settings-help-size); color: var(--muted); }
.drawer-submenu > summary::-webkit-details-marker {
  display: none;
}

.drawer-submenu > summary .drawer-chevron {
  margin-left: auto;
  transition: transform var(--motion);
}
.drawer-submenu[open] > summary .drawer-chevron { transform: rotate(180deg); }


.drawer-submenu-items {
  padding-left: var(--space-3);
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows var(--motion), opacity var(--motion);
}
.drawer-submenu[open] > .drawer-submenu-items { grid-template-rows: 1fr; opacity: 1; padding-top: 4px; animation: drawer-expand var(--motion) both; }
@keyframes drawer-expand { from { clip-path: inset(0 0 100% 0); transform: translateY(-6px); } to { clip-path: inset(0); transform: none; } }

#drawer .drawer-submenu-items > button {
  margin-bottom: 4px;
  padding-left: 24px;
  font-size: var(--settings-label-size, 15px);
}


.media-automation-line { display: flex; align-items: center; gap: var(--space-3); min-height: var(--button-height); flex-wrap: wrap; }
.media-setting-label { flex: 1; font: var(--settings-label-weight) var(--settings-label-size)/var(--settings-line-height) var(--font); color: var(--text); }
.media-automation-actions { display: inline-flex; align-items: center; gap: var(--space-1); }
.media-batch-action, .media-batch-status, .media-automation-help { margin-block: var(--settings-help-gap) var(--settings-option-gap); color: var(--text-secondary); font: var(--settings-help-weight) var(--settings-help-size)/var(--settings-line-height) var(--font); }
.media-batch-action:empty { display: none; }

.library-concurrency-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.library-concurrency-section p { margin: 0; }


.library-settings-status { margin: -12px 0 16px; font-size: var(--settings-help-size); }
.media-concurrency-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); min-width: 0; }
.media-concurrency-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.media-concurrency-label { display: inline-flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.media-concurrency-input { width: 80px; flex: none; }

dialog.library-batch-dialog { --form-columns: minmax(0, 1fr); width: min(560px, calc(100vw - 24px)); box-sizing: border-box; }
.library-batch-dialog .fm-form { min-width: 0; }
.library-batch-parent { width: 100%; min-width: 0; box-sizing: border-box; }
.library-batch-preview { min-width: 0; overflow-wrap: anywhere; max-height: min(42vh, 360px); overflow-y: auto; overflow-x: hidden; }
.library-batch-row { min-height: 44px; cursor: pointer; gap: 8px; }
.library-batch-row input[type="checkbox"] { flex: 0 0 44px; width: 44px; height: 44px; margin: 0; }
.library-batch-row > span { min-width: 0; overflow-wrap: anywhere; }
.library-batch-row small { display: block; overflow-wrap: anywhere; }
.library-batch-row:has(input:disabled) { opacity: .6; cursor: default; }
.library-batch-status { overflow-wrap: anywhere; }
