:root {
  color-scheme: dark;
  --bg: #141920;
  --pane: #1d232c;
  --pane-soft: #252d38;
  --image-bg: #303845;
  --line: #384250;
  --text: #e6ebf2;
  --muted: #9ba8b7;
  --accent: #2db4a6;
  --accent-dark: #81ddd4;
  --selected: #123b3c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.ui-icon { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.toolbar-button:has(.ui-icon) { display: inline-flex; align-items: center; gap: 6px; }
.brand-mark img { display: block; width: 32px; height: 32px; }
.tutorial-panel { position: fixed; right: 20px; bottom: 38px; width: min(390px, calc(100vw - 40px)); max-height: calc(100dvh - 120px); overflow: auto; z-index: 2000; background: var(--pane); color: var(--text); border: 1px solid var(--accent); border-radius: 12px; padding: 16px; box-shadow: 0 8px 28px #0008; font-size: 14px; }
.tutorial-panel header, .tutorial-panel footer, .tutorial-secondary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tutorial-panel header { color: var(--accent-dark); }
.tutorial-panel h2 { font-size: 18px; margin: 12px 0; }
.tutorial-panel p { line-height: 1.7; margin: 10px 0; }
.tutorial-panel button { cursor: pointer; min-height: 32px; }
.tutorial-panel .tutorial-instruction { background: var(--selected); border-radius: 6px; padding: 10px; }
.tutorial-panel #tutorialReady { color: var(--accent-dark); min-height: 20px; font-size: 12px; }
.tutorial-secondary { margin: 10px 0; }
.tutorial-secondary button { font-size: 12px; background: transparent; border: 0; text-decoration: underline; color: var(--muted); }
.tutorial-panel summary { cursor: pointer; margin-top: 12px; }
.tutorial-panel dt { font-weight: bold; margin-top: 10px; }
.tutorial-panel dd { margin: 4px 0 0; color: var(--muted); line-height: 1.6; }
.tutorial-panel.tutorial-in-dialog { position: relative; top: auto; right: auto; bottom: auto; width: auto; margin: 8px; max-height: none; z-index: 2; }
.tutorial-in-dialog #tutorialDescription, .tutorial-in-dialog details, .tutorial-in-dialog .tutorial-secondary { display: none; }
dialog:has(> .tutorial-panel) { overflow: auto; max-height: calc(100dvh - 32px); }
.tutorial-highlight { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) { .tutorial-panel { animation: tutorial-appear .15s ease-out; } }
@keyframes tutorial-appear { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body {
  margin: 0;
  min-width: 980px;
  overflow: hidden;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--pane-soft);
  color: var(--text);
  cursor: pointer;
  min-height: 36px;
  padding: 0 14px;
}

button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

.primary-button {
  border-color: #2f8279;
  background: #17645e;
  color: #f1fffd;
}

.primary-button:hover:not(:disabled) {
  border-color: #63d8cc;
  background: #1d756e;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--text);
  text-decoration: none;
}

.button-link:hover {
  border-color: #63d8cc;
  background: #1d756e;
}

.button-link[aria-disabled="true"] {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 36px;
  padding: 3px 10px;
  border-bottom: 1px solid var(--line);
  background: #171d25;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 190px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-height: 26px;
  padding: 0;
  border: 0;
  cursor: default;
}

.brand-mark:hover:not(:disabled) { border: 0; }

.developer-tools {
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
}

.developer-tools > p:first-child { margin-top: 0; color: var(--muted); }

.brand h1,
.pane-title h2,
.tag-editor h3,
.prompt-section h3 {
  margin: 0;
}

.brand h1 {
  font-size: 14px;
  line-height: 1.2;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 220px;
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.search-box,
.range-control,
.toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.viewer-status-bar #cancelAllTagsButton {
  margin-left: auto;
  flex-shrink: 0;
  height: 20px;
  min-height: 20px;
  padding: 0 7px;
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
}

.viewer-status-bar .scan-status {
  flex: 1;
  min-width: 0;
  max-width: none;
}

.scan-status {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  flex-shrink: 0;
  padding: 0 12px;
  border-top: 1px solid rgba(255, 255, 255, .16);
  background: #1d242c;
  min-width: 0;
}

.scan-progress {
  width: 96px;
  flex-shrink: 0;
  height: 8px;
  accent-color: var(--accent);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.context-menu {
  position: fixed;
  z-index: 50;
  display: grid;
  min-width: 160px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #202731;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
  padding: 4px;
}

.context-menu button {
  justify-content: flex-start;
  min-height: 32px;
  border: 0;
  background: transparent;
  padding: 0 10px;
  text-align: left;
}

.context-menu button:hover,
.context-menu button:focus-visible {
  background: #2b3541;
  outline: none;
}

.context-menu .danger-menu-item {
  color: #ff9d9d;
}

.action-toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 22px;
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid #376f6a;
  border-radius: 6px;
  background: #17383a;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  padding: 9px 14px;
  color: var(--text);
  font-size: 12px;
  text-align: center;
  transform: translateX(-50%);
}

.toggle-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.search-box input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161d;
  color: var(--text);
  padding: 0 10px;
}

.search-input-group {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-input-group input {
  padding-right: 34px;
}

.search-clear-button {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-clear-button:hover:not(:disabled),
.search-clear-button:focus-visible {
  background: #2b3541;
  color: var(--text);
}

.range-control input {
  width: min(42vw, 460px);
}

.viewer-grid {
  display: grid;
  grid-template-columns: 224px minmax(360px, 1fr) 288px;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.pane {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--pane);
  box-shadow: var(--shadow);
}

.pane-title,
.thumb-header,
.folder-header,
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 34px;
  min-height: 34px;
  padding: 3px 8px;
  border-bottom: 1px solid var(--line);
}

.thumb-header {
  position: relative;
  z-index: 5;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.thumb-header .pane-actions {
  min-width: 0;
}

.active-target-name {
  position: absolute;
  left: 50%;
  max-width: min(40%, 280px);
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
}

.thumb-header #imageCount {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.thumb-header .icon-button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  font-size: 15px;
}

.file-name-search,
.sort-menu {
  position: relative;
}

.file-name-search summary,
.sort-menu summary {
  list-style: none;
  cursor: pointer;
}

.file-name-search summary::-webkit-details-marker,
.sort-menu summary::-webkit-details-marker { display: none; }

.file-name-search.has-value summary {
  border-color: var(--accent);
  color: var(--accent);
}

.file-name-search input {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  left: 0;
  width: clamp(180px, 24vw, 280px);
  height: 30px;
  min-height: 30px;
  padding: 3px 8px;
  font-size: 13px;
  box-shadow: var(--shadow);
}

details.file-name-search:not([open]) > input,
.sort-menu:not([open]) > select {
  display: none;
}

.sort-menu select {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  left: 0;
  min-width: 150px;
  min-height: 28px;
  box-shadow: var(--shadow);
}

.view-options,
.folder-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.view-options {
  justify-content: space-between;
  margin-left: auto;
  flex-wrap: wrap;
}

.thumb-header #autoTagPreviewButton { order: 2; margin-left: auto; }
.folder-tree .folder-select { font-size: 12px; }

.folder-actions button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.folder-header {
  justify-content: space-between;
}

.root-folder-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  color: var(--text);
  text-align: left;
}

.root-folder-button span:first-child {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.root-folder-button:hover,
.root-folder-button:focus-visible {
  background: rgba(127, 198, 208, 0.14);
}

.root-folder-button[aria-current="true"] {
  background: var(--selected);
  color: var(--accent-dark);
}

.folder-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.folder-header-actions .icon-button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  font-size: 12px;
}

.folder-header p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-select {
  min-width: 0;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161d;
  color: var(--text);
  padding: 0 24px 0 8px;
  font-size: 11px;
}

.folder-header .compact-select {
  width: 88px;
}

.detail-header {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pane-title h2 {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane-title span,
.folder-header span {
  color: var(--muted);
  font-size: 12px;
}

.root-picker { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.root-picker select { min-width: 170px; max-width: 260px; min-height: 30px; background: #263441; color: #fff; border: 1px solid #60717d; border-radius: 5px; }
.folder-tree,
.thumbnail-scroll {
  overflow: auto;
}

.folder-tree {
  min-height: 0;
  padding: 8px;
  overflow-anchor: none;
}

.folder-pane {
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.folder-search { padding: 0 8px 8px; }
.folder-search input {
  width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.folder-search input:focus { border-color: var(--accent); outline: none; }

.folder-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 32px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

/* Large libraries can expose several thousand tree rows. Keep the complete
   tree available for keyboard navigation and drag targets, while letting
   Chromium skip paint and layout work for rows outside the scroll viewport. */
@supports (content-visibility: auto) {
  .folder-row {
    content-visibility: auto;
    contain-intrinsic-block-size: 32px;
  }
}

.folder-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  padding: 0 8px 0 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.folder-select[draggable="true"],
.folder-card[draggable="true"] {
  cursor: grab;
}

.folder-select[draggable="true"]:active,
.folder-card[draggable="true"]:active {
  cursor: grabbing;
}

.folder-reorder-handle {
  display: grid;
  place-items: center;
  width: 18px;
  height: 24px;
  border-radius: 4px;
  color: var(--muted);
  cursor: grab;
  font-size: 15px;
  line-height: 1;
  user-select: none;
}

.folder-reorder-handle:hover,
.folder-reorder-handle:focus-visible {
  background: rgba(127, 198, 208, 0.14);
  color: var(--text);
  outline: none;
}

.folder-reorder-handle:active {
  cursor: grabbing;
}

.folder-row.order-before {
  box-shadow: inset 0 2px var(--accent);
}

.folder-row.order-after {
  box-shadow: inset 0 -2px var(--accent);
}

.folder-row.order-inside {
  background: #17383a;
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent-dark);
}

.folder-row.drop-target,
.folder-card.drop-target {
  border-color: var(--accent);
  background: #17383a;
  color: var(--accent-dark);
}

.folder-row[aria-current="true"] {
  background: var(--selected);
  color: var(--accent-dark);
  font-weight: 700;
}

.folder-row[aria-current="true"].drop-target {
  background: #174447;
}

.folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-toggle {
  display: grid;
  place-items: center;
  width: 20px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.folder-toggle:disabled {
  opacity: 0;
}

.folder-toggle:not(:disabled):hover {
  background: rgba(127, 198, 208, 0.14);
  color: var(--text);
}

.folder-total {
  color: var(--muted);
  font-size: 12px;
}

.thumb-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
}
.thumb-pane > .thumb-header { grid-row: 1; }
.thumb-pane > .active-search-bar { grid-row: 2; }
.thumb-pane > .thumbnail-scroll { grid-row: 3; }

.thumbnail-scroll {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.thumbnail-scroll-options {
  display: flex;
  align-items: center;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
  padding: 5px 10px;
}

.thumbnail-grid {
  position: relative;
  --thumb-size: 220px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), var(--thumb-size)));
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  justify-content: start;
  gap: 10px;
  padding: 10px;
}

.thumbnail-grid .thumb-card img { height: calc(var(--thumb-size) - 4px); width: 100%; object-fit: contain; flex: none; }
.thumbnail-grid .folder-card img { min-height: 0; height: calc(var(--thumb-size) - 56px); width: 100%; object-fit: contain; flex: 1; }

.thumb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--pane-soft);
  cursor: pointer;
  height: max-content;
  min-height: 0;
  padding: 0;
  text-align: left;
}

.folder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: max-content;
  min-height: 0;
  border: 2px solid #638c78;
  border-radius: 8px;
  background: var(--pane-soft);
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.folder-card.prompt-scope-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.folder-card[aria-selected="true"] {
  border-color: var(--accent);
  background: #17383a;
}

.folder-card-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 5px 8px;
}

.folder-kind {
  border-radius: 4px;
  background: #315442;
  color: #e5f5eb;
  padding: 3px 5px;
  font-size: 10px;
  font-weight: 700;
}

.folder-actions[hidden], .context-menu button[hidden] {
  display: none;
}

.folder-card > .folder-reorder-handle {
  position: absolute;
  z-index: 2;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(230, 235, 242, 0.3);
  background: rgba(17, 22, 29, 0.86);
}

.folder-card.order-before {
  box-shadow: inset 3px 0 var(--accent);
}

.folder-card.order-after {
  box-shadow: inset -3px 0 var(--accent);
}

.folder-card.order-inside {
  border-color: var(--accent);
  background: #17383a;
}

.folder-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.folder-card-header span,
.folder-card-header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card-header .folder-card-name {
  font-size: 12px;
  font-weight: 700;
}

.folder-card-header small {
  color: var(--muted);
  font-size: 11px;
}

.folder-card img,
.folder-card-empty {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--image-bg);
}

.folder-card-empty {
  background:
    linear-gradient(135deg, transparent 0 45%, rgba(102, 120, 138, 0.18) 45% 55%, transparent 55%),
    var(--image-bg);
}

.thumb-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.thumb-card[aria-selected="true"] {
  border-color: var(--accent);
  background: #17383a;
}

.thumbnail-selection-box {
  position: absolute;
  z-index: 5;
  border: 1px solid var(--accent);
  background: rgba(65, 199, 193, 0.16);
  pointer-events: none;
}

.thumb-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(var(--thumb-size) * 1.6);
  object-fit: contain;
  background: var(--image-bg);
}

.thumb-card span {
  overflow: hidden;
  padding: 8px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-card-name {
  cursor: text;
}

.thumb-card-name:hover {
  color: var(--accent);
}

.thumb-card-tags {
  overflow: hidden;
  min-height: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.settings-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--pane);
  color: var(--text);
  padding: 0;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.24);
}

.settings-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.toolbar-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--pane-soft);
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
}

.eagle-import-dialog {
  width: min(620px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--pane);
  color: var(--text);
  padding: 0;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.35);
}

.tools-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--pane);
  color: var(--text);
  padding: 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.tools-dialog::backdrop { background: rgba(8, 15, 24, 0.68); }
.tools-panel .settings-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 20px; }
.tool-card { display: grid; grid-template-rows: auto auto auto minmax(32px, 1fr) auto; gap: 8px; min-height: 220px; padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: var(--pane-soft); }
.tool-card-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 12px; background: #174f4d; color: var(--accent-dark); font-size: 32px; line-height: 1; }
.tool-card h3 { margin: 0; font-size: 18px; }
.tool-card p, .tool-card-status { margin: 0; color: var(--muted); font-size: 13px; }
.tool-card-status { overflow-wrap: anywhere; }
.tool-card button { width: 100%; }
@media (max-width: 640px) { .tools-grid { grid-template-columns: 1fr; } }

.eagle-import-dialog::backdrop { background: rgba(8, 15, 24, 0.58); }
.eagle-import-panel { margin: 0; }
.eagle-import-panel .settings-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.eagle-import-body { display: grid; gap: 0; padding: 8px 18px 18px; }
.eagle-import-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.eagle-import-step h3, .eagle-import-step p { margin: 0; }
.eagle-import-step h3 { font-size: 14px; }
.eagle-import-step p { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.eagle-step-number { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 12px; font-weight: 700; }
.eagle-import-action { border-bottom: 0; }
.eagle-import-progress { display: flex; align-items: center; gap: 10px; min-height: 34px; border: 1px solid #376f6a; border-radius: 7px; background: #17383a; padding: 8px 10px; color: var(--accent-dark); font-size: 12px; }
.eagle-import-progress progress { width: 120px; }
.eagle-import-conflicts { max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px; border: 1px solid #b78461; border-radius: 6px; color: #ffd3b0; background: #3b2c25; font-size: 12px; }
.top-bar { flex-wrap: wrap; row-gap: 6px; }
.eagle-status-bar { display: flex; flex-basis: 100%; gap: 14px; align-items: center; padding: 8px 10px; border: 1px solid #376f6a; border-radius: 6px; background: #17383a; }
.eagle-status-copy { display: grid; flex: 1; min-width: 0; gap: 4px; font-size: 12px; }
.eagle-status-copy strong { font-size: 13px; }
.eagle-status-copy progress { width: 100%; height: 6px; accent-color: var(--accent); }
.eagle-status-actions { display: flex; gap: 6px; }
.eagle-status-actions button { min-height: 30px; padding: 0 10px; font-size: 12px; }
.eagle-status-bar[data-status="failed"], .eagle-status-bar[data-status="cancelled"] { border-color: #b78461; background: #3b2c25; }

.settings-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  margin: 0;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px 8px 16px;
  background: var(--pane);
  z-index: 1;
}

.settings-header h2 {
  margin: 0;
  font-size: 16px;
}

.settings-body {
  display: grid;
  gap: 18px;
  padding: 16px;
  min-height: 0;
  overflow: auto;
}

.settings-section {
  display: grid;
  gap: 10px;
}

.settings-section h3,
.settings-section p {
  margin: 0;
}

.settings-section h3 {
  font-size: 14px;
}

.settings-section p {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.settings-section #settingsLibraryRootInput {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
}

.auto-tag-help {
  line-height: 1.6;
}

.settings-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-status {
  min-height: 18px;
}

.metadata-migration-summary {
  min-height: 32px;
}

.reconciliation-case {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #3b4758;
  border-radius: 7px;
  background: #202936;
}

.reconciliation-case strong { font-size: 12px; }
.reconciliation-case p { margin: 5px 0 8px; color: var(--muted); font-size: 12px; }
.reconciliation-actions input { min-width: min(100%, 280px); flex: 1 1 220px; }

.settings-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  background: var(--pane);
  z-index: 1;
}

.settings-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--text);
  font-size: 13px;
}

.settings-check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.dialog-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.dialog-form-row input {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161d;
  color: var(--text);
  padding: 0 10px;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  height: calc(100% - 34px);
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.loading-state {
  display: grid;
  gap: 12px;
  width: min(360px, 100%);
}

.loading-state p {
  margin: 0;
}

.loading-state progress {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}

.detail-pane {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.tag-pane-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tag-pane-tabs button { border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 10px; font-weight: 700; }
.tag-pane-tabs button[aria-selected="true"] { color: var(--text); box-shadow: inset 0 -2px var(--accent); background: var(--pane-soft); }
.tag-pane-panel { min-height: 0; overflow: auto; }
.tag-pane-panel .detail-scroll-region { height: 100%; }
.active-search-bar { display: flex; align-items: center; gap: 12px; min-height: 32px; padding: 5px 12px; border-bottom: 1px solid var(--line); background: var(--pane-soft); color: var(--muted); font-size: 12px; }
.active-search-bar[hidden] { display: none; }
.active-search-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-search-bar button { flex: none; padding: 4px 8px; font-size: 12px; }
.detail-info-panel { padding: 16px; }
.detail-preview { display: block; width: 100%; max-height: 250px; object-fit: contain; border-radius: 6px; background: var(--pane-soft); }
.detail-image-name { margin: 14px 0; overflow-wrap: anywhere; font-size: 15px; }
.detail-metadata { display: grid; gap: 10px; margin: 0; font-size: 12px; }
.detail-metadata > div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
.detail-metadata dt { color: var(--muted); }
.detail-metadata dd { margin: 0; overflow-wrap: anywhere; }
.search-tools-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--pane); color: var(--text); padding: 0; }
.search-tools-dialog::backdrop { background: rgba(8, 15, 24, 0.68); }
.search-tools-dialog .tag-pane-tabs { grid-template-columns: repeat(2, 1fr); }

.tag-tools {
  display: grid;
  gap: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.prompt-search-tools { display: grid; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.prompt-search-tools h3 { margin: 0; color: var(--muted); font-size: 12px; }

.tag-tools #tagSearchBody {
  display: grid;
  gap: 12px;
  padding: 12px;
}

#autoTagPreviewButton {
  max-width: 100%;
  flex-shrink: 0;
}

.settings-panel { max-height: calc(100dvh - 48px); overflow: auto; }
.tag-setting-choice { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; }
.tag-setting-choice small { display: block; color: var(--muted); overflow-wrap: anywhere; margin-top: 4px; }
.tag-rule-editor {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0 14px;
  margin-bottom: 14px;
}
.tag-rule-editor h4 { margin: 18px 0 6px; font-size: 14px; }
.clothing-rule-list { display: grid; gap: 8px; max-height: 360px; overflow: auto; padding-right: 4px; }
.clothing-rule-row { display: grid; grid-template-columns: minmax(100px, 0.45fr) minmax(0, 1.55fr) auto; gap: 6px; align-items: center; }
.clothing-rule-row input, .blocked-context-add input { min-width: 0; width: 100%; }
.clothing-rule-remove { color: var(--danger); }
.blocked-context-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.blocked-context-chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-muted); font-size: 12px; }
.blocked-context-chip button { border: 0; background: transparent; color: var(--muted); padding: 0 2px; cursor: pointer; font-size: 14px; line-height: 1; }
.blocked-context-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.folder-row[data-drop-guide], .folder-card[data-drop-guide] { position: relative; overflow: visible; z-index: 5; }
[data-drop-guide]::after { content: attr(data-drop-guide); position: absolute; right: 4px; top: -22px; background: #14665b; color: #fff; padding: 3px 6px; border-radius: 3px; font-size: 12px; pointer-events: none; white-space: nowrap; }
.folder-row.order-before { box-shadow: inset 0 4px #5ee6bb; }
.folder-row.order-after { box-shadow: inset 0 -4px #5ee6bb; }
.folder-card.order-before { box-shadow: inset 5px 0 #5ee6bb; }
.folder-card.order-after { box-shadow: inset -5px 0 #5ee6bb; }

.tag-tools .search-box {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
}

.tag-filter-tools {
  display: grid;
  gap: 8px;
}

.tag-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag-filter-actions {
  display: flex;
  gap: 6px;
}

.tag-filter-actions button {
  min-height: 24px;
  padding: 0 8px;
  font-size: 11px;
}

.tag-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 92px;
  overflow: auto;
}

.visible-tag-option,
.hidden-tag-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  border: 1px solid #405465;
  border-radius: 999px;
  background: #17212c;
  color: #cbd6e4;
  padding: 0 8px 0 6px;
  font-size: 12px;
}

.visible-tag-option input,
.hidden-tag-option input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.visible-tag-option:has(input:checked) {
  border-color: #376f6a;
  background: #17383a;
  color: var(--accent-dark);
}

.hidden-tag-option:has(input:checked) {
  border-color: #8a3d44;
  background: #3a1f27;
  color: #ffccd3;
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.detail-scroll-region {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.detail-empty {
  margin: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--pane-soft);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.detail-content {
  min-height: 0;
  padding: 12px;
}

.selection-summary {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--pane-soft);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.metadata-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.metadata-list div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.metadata-list dt {
  color: var(--muted);
  font-size: 12px;
}

.metadata-list dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 12px;
}

.file-actions,
.tag-editor,
.prompt-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.prompt-search-tools {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
  padding: 0;
}

.prompt-search-tools h3 {
  margin: 0;
  font-size: 14px;
}

.prompt-search-tools #promptSearchBody {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.prompt-search-target {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-search-tools #promptTagList,
.prompt-search-tools #folderPromptTagList {
  max-height: none;
  overflow: visible;
}

.selected-prompt-filters {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--pane-soft);
}

.selected-prompt-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.selected-prompt-filters .tag-candidate-list { margin-top: 0; }

.tag-danger-zone {
  margin-top: 16px;
  border: 1px solid #8a3d44;
  border-radius: 7px;
  padding: 10px;
  background: #3a1f27;
}

.tag-danger-zone h4,
.tag-danger-zone p { margin: 0; }
.tag-danger-zone h4 { color: #ffccd3; font-size: 13px; }
.tag-danger-zone p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.tag-danger-zone button { margin-top: 9px; }

.file-actions h3,
.tag-editor h3,
.prompt-section h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

.prompt-toggle {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  padding: 0 12px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}


.prompt-filter-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.file-actions {
  display: grid;
  gap: 8px;
}

.repair-actions {
  display: block;
}

.repair-actions button {
  width: 100%;
  padding: 0 8px;
  font-size: 12px;
}

.rename-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.rename-form input {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161d;
  color: var(--text);
  padding: 0 10px;
}

.danger-button {
  border-color: #8a3d44;
  color: #ffb4bd;
}

.danger-button:hover:not(:disabled) {
  border-color: #d92d20;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.tag-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--pane-soft);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.tag-toggle:has(input:checked),
.tag-toggle:has(input:indeterminate) {
  border-color: var(--accent);
}

.tag-candidate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.prompt-tag-candidate {
  display: inline-flex;
  min-width: 0;
}

.prompt-tag-candidate .tag-candidate {
  border-radius: 5px 0 0 5px;
}

.prompt-tag-hide {
  display: grid;
  width: 26px;
  min-width: 26px;
  border-width: 1px 1px 1px 0;
  border-color: #4a5a6e;
  border-radius: 0 5px 5px 0;
  background: #3b2730;
  color: #ffd9e2;
  padding: 0;
  place-items: center;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  border: 1px solid #376f6a;
  border-radius: 999px;
  background: #17383a;
  color: var(--accent-dark);
  padding: 0 8px;
  font-size: 12px;
}

.tag-candidate {
  min-height: 28px;
  border-color: #4a5a6e;
  background: #253041;
  color: #c7d7ec;
  padding: 0 8px;
  font-size: 12px;
}

.tag-candidate.prompt-tag-tone-0 { border-color: #417b98; background: #1c394a; color: #c8ecff; }
.tag-candidate.prompt-tag-tone-1 { border-color: #5d7f4c; background: #2b4227; color: #d5f4c8; }
.tag-candidate.prompt-tag-tone-2 { border-color: #8a6c45; background: #49371f; color: #ffe0ad; }
.tag-candidate.prompt-tag-tone-3 { border-color: #83608e; background: #422c49; color: #f3d6ff; }
.tag-candidate.prompt-tag-tone-4 { border-color: #9a5e70; background: #4b2934; color: #ffd5df; }
.tag-candidate.prompt-tag-tone-5 { border-color: #527f7a; background: #213f3d; color: #c6f3ed; }

.tag-chip button {
  min-height: 20px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.tag-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.tag-form input {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161d;
  color: var(--text);
  padding: 0 10px;
}

.auto-tag-dialog {
  width: min(920px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--pane);
  color: var(--text);
  padding: 0;
}

.auto-tag-dialog::backdrop {
  background: rgba(0, 0, 0, 0.52);
}

.auto-tag-panel {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  max-height: calc(100vh - 48px);
}

.auto-tag-header,
.auto-tag-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.auto-tag-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.auto-tag-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.auto-tag-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.auto-tag-list {
  display: grid;
  align-content: start;
  gap: 0;
  overflow: auto;
}

.auto-tag-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.auto-tag-sample {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161d;
  object-fit: cover;
}

.auto-tag-sample.load-error {
  visibility: hidden;
}

.auto-tag-row-details {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.auto-tag-row-title {
  overflow-wrap: anywhere;
  font-weight: 700;
  font-size: 13px;
}

.auto-tag-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auto-tag-check {
  display: inline-grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 30px;
  border: 1px solid #405465;
  border-radius: 999px;
  background: #17212c;
  padding: 0 9px 0 6px;
  font-size: 12px;
}

.auto-tag-check input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.auto-tag-check small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-tag-existing {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

#promptText, #negativePromptText {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161d;
  padding: 10px;
  color: #d1d8e2;
  font: 12px/1.6 "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}

#detailPromptPanel .prompt-section { padding: 12px; }
#negativePromptSection { margin-top: 16px; }
#addSelectedPromptTag { margin-top: 12px; }

.image-viewer-dialog {
  position: fixed;
  top: 2vh;
  left: 2vw;
  width: min(96vw, 1600px);
  height: 96vh;
  max-height: 96vh;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #fff;
  padding: 0;
}

.image-viewer-dialog::backdrop {
  background: rgba(15, 23, 42, 0.72);
}

.image-viewer-panel {
  display: grid;
  grid-template-rows: 38px 1fr 42px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.image-viewer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto 30px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 8px 4px 12px;
  cursor: move;
  user-select: none;
}

.image-viewer-header button { cursor: pointer; }

#imageViewerRepairButton { min-width: 112px; }

.image-viewer-header span {
  overflow: hidden;
  color: #e5e7eb;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#imageViewerPosition {
  color: var(--muted);
}

.image-viewer-body {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  position: relative;
}

#imageViewerImage {
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  transition: transform 80ms ease-out;
}

@media (max-width: 1120px) {
  body {
    min-width: 760px;
  }

  .viewer-grid {
    grid-template-columns: 230px minmax(300px, 1fr) 310px;
  }

  .search-box input {
    width: 190px;
  }
}
.image-viewer-nav { position: absolute; z-index: 1; top: 50%; transform: translateY(-50%); width: 42px; height: 72px; border: 0; border-radius: 8px; background: rgba(15, 23, 42, .72); color: #fff; font-size: 44px; cursor: pointer; }
.image-viewer-nav:disabled { opacity: .28; cursor: default; }
.image-viewer-nav-prev { left: 16px; }
.image-viewer-nav-next { right: 16px; }
.image-viewer-footer { display: flex; align-items: center; justify-content: center; gap: 10px; border-top: 1px solid rgba(255,255,255,.14); color: #d1d5db; font-size: 12px; }
.image-viewer-footer input { width: min(280px, 40vw); }

/* The everyday workspace follows the approved three-pane concept. */
.top-bar { min-height: 44px; padding: 4px 14px; background: #1c242e; }
.brand { gap: 10px; min-width: 0; }
.brand-mark { width: 28px; height: 28px; min-height: 28px; border-radius: 4px; font-size: 23px; }
.brand h1 { font-size: 15px; white-space: nowrap; }
.toolbar { gap: 8px; }
.toolbar #toolsButton, .toolbar #settingsButton { min-height: 32px; border-radius: 6px; }
.toolbar #toolsButton { padding-inline: 12px; font-size: 12px; }
.toolbar #settingsButton { width: 32px; min-width: 32px; height: 32px; font-size: 18px; }
.scan-status { max-width: 310px; font-size: 11px; }
.scan-status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--accent); }

.viewer-grid { grid-template-columns: minmax(200px, 19.2%) minmax(390px, 1fr) minmax(240px, 20%); gap: 0; padding: 0; }
.viewer-grid > .pane { border-top: 0; border-bottom: 0; border-left: 0; border-radius: 0; box-shadow: none; }
.viewer-grid > .pane:last-child { border-right: 0; }
.folder-pane { grid-template-rows: auto auto minmax(0, 1fr); }
.folder-search { grid-row: 1; padding: 18px 18px 10px; }
.folder-header { grid-row: 2; height: 44px; min-height: 44px; padding-inline: 14px; }
.folder-tree { grid-row: 3; padding: 8px 10px; }
.folder-search input { min-height: 40px; border-radius: 7px; background: #202a35; font-size: 13px; }
.folder-row { min-height: 32px; }
.folder-row[aria-current="true"], .folder-row[aria-selected="true"] { background: #234044; }
.folder-select { min-height: 30px; }
.folder-name::before { content: ""; display: inline-block; width: 15px; height: 12px; margin-right: 9px; border-radius: 2px; background: #bed8e4; clip-path: polygon(0 20%, 34% 20%, 44% 0, 100% 0, 100% 100%, 0 100%); vertical-align: -1px; }
.root-folder-button { grid-template-columns: 20px minmax(0, 1fr) auto; }
.root-folder-button::before { content: ""; display: block; width: 17px; height: 14px; border-radius: 2px; background: var(--accent-dark); clip-path: polygon(0 20%, 34% 20%, 44% 0, 100% 0, 100% 100%, 0 100%); }

.thumb-header { display: flex; flex-direction: column; align-items: stretch; justify-content: center; height: auto; min-height: 100px; padding: 10px 18px; }
.thumb-location { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.thumb-location .active-target-name { flex: 1; min-width: 0; }
.thumb-size-control { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--muted); font-size: 11px; white-space: nowrap; }
.thumb-size-control input { width: 90px; height: 18px; accent-color: var(--accent); }
.active-target-name { position: static; max-width: 100%; color: #c3d0de; font-size: 13px; transform: none; }
.thumb-header .pane-actions { width: 100%; gap: 9px; }
.thumb-header .file-name-search { flex: 1; min-width: 110px; }
.thumb-header .file-name-search input { position: static; display: block; width: 100%; height: 38px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: #202a35; font-size: 13px; box-shadow: none; }
.thumb-header .sort-menu { flex: none; }
.thumb-header .sort-menu select { position: static; display: block; width: 154px; height: 38px; min-height: 38px; padding: 0 12px; border-radius: 7px; background: #202a35; font-size: 12px; box-shadow: none; }
.thumb-header #searchToolsButton { min-height: 38px; padding-inline: 12px; white-space: nowrap; }
.thumb-header #undoDeleteButton:disabled { display: none; }
.thumbnail-scroll-options { border-bottom: 0; padding-inline: 18px; }
.thumbnail-grid { gap: 12px; padding: 12px 18px; }

.detail-header { min-height: 52px; padding-inline: 18px; color: var(--text); font-size: 14px; }
.detail-preview-shell { min-height: 224px; padding: 18px 18px 8px; }
.detail-preview-placeholder { display: grid; place-items: center; height: 180px; border: 1px solid var(--line); border-radius: 7px; background: linear-gradient(145deg, #344456 0 48%, #43566a 49% 52%, #293947 53%); color: #d6e0eb; font-size: 13px; }
.detail-preview-shell .detail-preview { height: 180px; width: 100%; max-height: 180px; }
.detail-preview-shell .detail-image-name { margin: 11px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-pane-tabs button { min-height: 47px; font-size: 13px; }
.tag-pane-tabs button[aria-selected="true"] { color: var(--accent-dark); background: transparent; }
.detail-info-panel { padding: 18px; }
.detail-preview { max-height: 290px; border-radius: 7px; }
.detail-image-name { margin: 18px 0; font-size: 16px; }
.detail-metadata { gap: 13px; font-size: 13px; }
.detail-metadata > div { grid-template-columns: 86px minmax(0, 1fr); }
#tagSettingsPanel { display: flex; flex-direction: column; }
#tagSettingsPanel[hidden] { display: none; }
#tagSettingsPanel .detail-scroll-region { flex: 1; min-height: 0; height: auto; overflow: auto; }
.detail-folder-tag-actions { margin: 12px 18px 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.detail-folder-tag-actions button { width: 100%; min-height: 36px; font-size: 12px; }
.prompt-source-help, .prompt-source-path { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.prompt-source-path { color: var(--text); }
.auto-tag-header > div { min-width: 0; }
.auto-tag-header .auto-tag-source-help { margin-top: 5px; line-height: 1.45; }
#autoTagProgress { width: min(400px, 100%); height: 7px; margin-top: 9px; accent-color: var(--accent); }

.tools-dialog { width: min(680px, calc(100vw - 32px)); border-radius: 10px; background: #1c252e; }
.tools-panel .settings-header { padding: 20px 24px 12px; border-bottom: 0; }
.tools-panel .settings-header h2 { font-size: 21px; }
.tools-panel .settings-header p { display: none; }
.tools-grid { gap: 16px; padding: 12px 24px 24px; }
.tool-card { grid-template-rows: 62px auto auto minmax(20px, 1fr) 40px; justify-items: center; gap: 8px; min-height: 235px; padding: 20px; background: #202a34; text-align: center; }
.tool-card-icon { width: 60px; height: 60px; border-radius: 12px; font-size: 39px; }
.tool-card h3 { font-size: 19px; }
.tool-card p { font-size: 13px; }
.tool-card-status { font-size: 11px; }
.tool-card button { min-height: 40px; font-size: 14px; }

@media (max-width: 1120px) {
  .viewer-grid { grid-template-columns: 180px minmax(350px, 1fr) 240px; }
  .scan-status { max-width: 180px; }
  .thumb-header #searchToolsButton { font-size: 11px; }
  .thumb-header .sort-menu select { width: 130px; }
}

/* Pane boundaries retain a usable center while allowing individual widths. */
.viewer-grid { grid-template-columns: var(--left-pane-width, minmax(200px, 19.2%)) 6px minmax(280px, 1fr) 6px var(--right-pane-width, minmax(240px, 20%)); }
.pane-resizer { cursor: col-resize; touch-action: none; background: var(--line); outline-offset: -2px; }
.pane-resizer:hover, .pane-resizer:focus-visible { background: var(--accent); }
@media (max-width: 1120px) {
  .viewer-grid { grid-template-columns: var(--left-pane-width, 180px) 6px minmax(280px, 1fr) 6px var(--right-pane-width, 240px); }
}
.display-options-dialog { width: 320px; padding: 16px; background: var(--pane); color: var(--text); border: 1px solid var(--line); border-radius: 8px; }
.display-options-dialog label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.display-options-dialog .dialog-header { display: flex; align-items: center; justify-content: space-between; }
.display-options-dialog { width: min(520px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); overflow: auto; }
.central-settings-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.central-settings-tabs [role="tab"] { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--pane); color: var(--text); cursor: pointer; }
.central-settings-tabs [aria-selected="true"] { background: var(--selected); border-color: var(--accent); }
.central-settings-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.central-settings-panel[hidden] { display: none; }
.central-settings-panel h3 { font-size: 15px; margin: 18px 0 8px; }
.central-settings-panel select { max-width: 65%; }
.central-settings-panel .thumb-size-control { display: flex; }
.central-settings-panel input[type="range"] { width: min(270px, 65%); }
.central-settings-help { font-size: 12px; line-height: 1.6; color: var(--muted); }
.central-settings-footer { display: flex; justify-content: flex-end; padding-top: 8px; }
.viewer-grid { position: relative; }
.viewer-grid.hide-left { grid-template-columns: 0 0 minmax(280px,1fr) 6px var(--right-pane-width,240px); }
.viewer-grid.hide-right { grid-template-columns: var(--left-pane-width,200px) 6px minmax(280px,1fr) 0 0; }
.viewer-grid.hide-left.hide-right { grid-template-columns: 0 0 minmax(280px,1fr) 0 0; }
.hide-left > .folder-pane, .hide-right > .detail-pane { visibility: hidden; pointer-events: none; }
.hide-left > [data-pane=left], .hide-right > [data-pane=right] { visibility: hidden; }
.sidebar-edge { position: fixed; top: 45%; z-index: 31; width: 16px; min-height: 64px; padding: 0; opacity: .65; }
.sidebar-edge-left { left: 0; } .sidebar-edge-right { right: 0; }
.hide-image-names .thumb-card-name { visibility: hidden; }
.hide-image-tags .thumb-card-tags { visibility: hidden; }
.visual-edit-controls { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; }
#colorFilterInput, #imageColorInput { width: 30px; min-height: 28px; padding: 2px; }
.viewer-grid > .folder-pane { grid-column: 1; grid-row: 1; }
.viewer-grid > [data-pane=left] { grid-column: 2; grid-row: 1; }
.viewer-grid > .thumb-pane { grid-column: 3; grid-row: 1; }
.viewer-grid > [data-pane=right] { grid-column: 4; grid-row: 1; }
.viewer-grid > .detail-pane { grid-column: 5; grid-row: 1; }
.thumb-item-info { position: absolute; right: 5px; top: 5px; border-radius: 3px; padding: 2px 4px; font-size: 11px; color: white; background: #0009; pointer-events: none; }

/* Compact two-row image toolbar. */
.thumb-header { min-height: 0; padding: 10px 12px; gap: 8px; }
.thumb-header .thumb-location[hidden], .filter-row[hidden] { display: none; }
.thumb-header .pane-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.thumb-header .file-name-search { flex: 1 1 160px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.filter-row select, .filter-row button { min-height: 32px; }
#filterSummarySlot { flex-basis: 100%; }
#filterSummarySlot .active-search-bar { margin: 0; }
#filterScopeSlot .thumbnail-scroll-options { position: static; padding: 0; margin: 0; }
.hide-image-names .thumb-card-name, .hide-image-tags .thumb-card-tags { display: none; }
.disabled-option { opacity: .45; }
.rating-help { margin: 6px 12px; color: var(--muted); font-size: 12px; }
.visual-edit-controls { flex-wrap: wrap; padding: 8px 12px; }
.visual-edit-controls label { display: flex; align-items: center; gap: 6px; }
.thumb-pane { grid-template-rows: auto minmax(0, 1fr); }
.thumb-pane > .thumbnail-scroll { grid-row: 2; }

.waterfall-layout .thumb-card img { max-height: none; }

.list-layout .thumb-card { display: grid; grid-template-columns: minmax(100px, 2fr) minmax(80px, 1fr) 60px 100px; align-items: center; gap: 8px; border-radius: 4px; }
.list-layout .thumb-card-name { display: block; cursor: default; }
.list-layout .thumb-card-tags { border: 0; min-height: 0; }
.list-layout .hide-image-names .thumb-card-name { display: block; }
.list-layout.hide-image-names .thumb-card-name { display: block; }
.list-layout .list-rating, .list-layout .list-size { text-align: right; color: var(--muted); }
.list-layout .folder-card { flex-direction: row; align-items: center; padding: 0 8px; }
.list-layout .folder-card img, .list-layout .folder-card-empty { display: none; }
.list-layout .thumb-size-control { display: none; }
.list-layout.hide-image-tags .thumb-card { grid-template-columns: minmax(100px, 1fr) 60px 100px; }

#imageRatingNumberInput { width: 62px; min-width: 62px; }

.thumb-header .pane-actions > label { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.thumb-header .pane-actions select, .thumb-header .pane-actions button { height: 34px; min-height: 34px; }
.thumb-header .pane-actions select { width: 130px; }
.thumb-header .pane-actions .filter-toggle { margin-left: auto; width: 34px; }
.filter-row .file-name-search { display: flex; align-items: center; gap: 6px; flex: 0 1 300px; max-width: 340px; min-width: 180px; }
.file-name-search select { height: 34px; min-height: 34px; width: 104px; flex-shrink: 0; }
.file-name-search input { min-width: 0; }
.toolbar-popover { position: relative; }
.toolbar-popover summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 6px; height: 34px; min-width: 34px; padding: 4px 8px; text-align: center; font-size: 20px; }
.toolbar-popover summary::-webkit-details-marker { display: none; }
.toolbar-popup { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; padding: 10px; min-width: 190px; border: 1px solid var(--line); border-radius: 8px; background: var(--pane-soft); box-shadow: 0 8px 24px #0008; }
.star-buttons { display: flex; gap: 4px; margin-bottom: 8px; }
.star-buttons button { min-width: 30px; padding: 2px; font-size: 22px; }
.toolbar-popup button[aria-pressed="true"] { color: var(--accent); }
.thumbnail-scroll-options { position: sticky; top: 0; z-index: 10; background: var(--pane-soft); }
.thumb-pane { grid-template-rows: auto minmax(0, 1fr); }
.visual-edit-controls [hidden] { display: none; }

.detail-pane { grid-template-rows: auto auto auto auto minmax(0, 1fr); }
.inspector-rating .star-buttons { gap: 2px; margin: 0; }
.inspector-rating .star-buttons button { width: 24px; min-width: 24px; height: 24px; min-height: 24px; padding: 0; font-size: 20px; line-height: 1; border: 0; background: transparent; box-shadow: none; }
.inspector-rating .star-buttons button[aria-pressed="true"] { color: var(--accent); }
.detail-preview-shell { min-height: 0; }
.thumb-header .sort-menu select { height: 34px; min-height: 34px; }
.filter-row .file-name-search input, .filter-row #searchToolsButton { height: 34px; min-height: 34px; }
.toolbar-popup select { width: 100%; }

/* Keep the filter toolbar compact when no summary is present. */
.thumbnail-scroll-options { position: static; }
#filterScopeSlot:empty, #filterSummarySlot:has(.active-search-bar[hidden]), .thumb-header .view-options:has(> .folder-actions[hidden]) { display: none; }
#filterSummarySlot { flex: 1 1 180px; min-width: 0; }
#filterSummarySlot .active-search-bar { min-height: 34px; padding: 0 8px; border: 0; border-radius: 6px; }
.filter-row { gap: 8px; padding-top: 8px; }

.thumb-pane { container-type: inline-size; }
.right-toolbar-actions { display: flex; gap: 8px; margin-left: auto; }
.thumb-header .pane-actions .filter-toggle { margin-left: 0; }
@container (max-width: 900px) {
  .thumb-header .pane-actions > label > span { display: none; }
  .thumb-header .pane-actions > label select { width: 110px; }
}
@container (max-width: 680px) {
  .thumb-header .pane-actions > label select { width: 90px; }
  .thumb-header .thumb-size-control input { width: 70px; }
}

/* Registered-root overview: keep each image's origin visible and actions explicit. */
.all-root-image { color: var(--text); text-align: left; padding: 0; font: inherit; }
.all-root-image .thumb-card-name { display: block; padding: 5px 8px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.all-root-location { display: block; padding: 2px 8px 8px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.all-root-more { min-height: 48px; align-self: start; }

/* Root registration is managed only in Settings; the top selector changes the view. */
.registered-roots { display: grid; gap: 8px; margin: 10px 0 16px; }
.registered-root-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.registered-root-row > div { min-width: 0; display: grid; gap: 4px; }
.registered-root-row small { color: var(--muted); overflow-wrap: anywhere; }
.current-root-badge { width: fit-content; padding: 2px 7px; border-radius: 20px; background: var(--accent); color: #fff; font-size: 12px; }


.root-switch-wrap { position: relative; flex: none; }
.root-switch-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 5px; background: transparent; cursor: pointer; font-size: 20px; }
.root-switch-button:hover, .root-switch-button[aria-expanded="true"] { background: var(--selected); }
.root-switch-menu { position: absolute; z-index: 100; top: 36px; left: 0; width: max-content; min-width: 190px; max-width: min(350px, 90vw); max-height: 300px; overflow: auto; padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--pane); box-shadow: 0 8px 24px #0008; }
.root-switch-menu[hidden] { display: none; }
.root-switch-menu button { display: block; width: 100%; padding: 8px; border: 0; border-radius: 4px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.root-switch-menu button:hover, .root-switch-menu button:focus-visible { background: var(--selected); }
.root-switch-menu button[aria-checked="true"] { color: var(--accent-dark); font-weight: 700; }
.root-folder-button::before { display: none; }
.folder-header { justify-content: flex-start; }
.folder-header .root-folder-button { flex: 1; grid-template-columns: minmax(0, 1fr) auto; }
.folder-header .folder-header-actions { flex: none; }

.thumbnail-scroll.all-roots-scroll { scrollbar-gutter: stable; }
.thumbnail-grid.all-roots-grid { grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size), 1fr)); justify-content: stretch; }
.thumbnail-grid.all-roots-grid > .all-root-image, .thumbnail-grid.all-roots-grid > .folder-card, .thumbnail-grid.all-roots-grid > .all-root-more { width: min(100%, var(--thumb-size)); justify-self: center; }

.viewer-restart-status { max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-text, #a8c2ce); font-size: .8rem; }

.tutorial-guide { display: flex; align-items: center; gap: 10px; }
.tutorial-guide img { flex: 0 0 auto; width: 56px; height: 56px; }
.tutorial-guide strong { display: block; color: var(--text); font-size: 14px; }
.tutorial-guide #tutorialProgress { display: block; margin-top: 4px; font-size: 12px; }
.tutorial-in-dialog .tutorial-guide img { width: 40px; height: 40px; }
.intake-dialog{width:min(760px,90vw);max-height:88vh;overflow:auto;background:#1d2630;color:#e7eff4;border:1px solid #648a99;border-radius:16px;padding:28px;box-shadow:0 16px 80px #0009}.intake-dialog::backdrop{background:#081018b8}.intake-dialog p{white-space:pre-wrap;line-height:1.7}.intake-dialog textarea{display:block;width:100%;box-sizing:border-box;margin:10px 0;padding:10px;background:#111b25;color:inherit}.intake-dialog progress{width:100%;height:24px;accent-color:#39b9a6}.intake-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:20px}.intake-dialog iframe{width:100%;height:60vh;border:0}.move-ghost{position:fixed;z-index:2147483647;pointer-events:none;object-fit:cover;border-radius:8px}.move-activity{width:min(600px,90vw)}

.quality-picker-dialog { width: min(680px, 90vw); }
.quality-picker-list { max-height: 50vh; overflow-y: auto; display: grid; gap: 8px; }
.quality-picker-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); padding: 8px; border-radius: 6px; }
.quality-picker-item img { width: 72px; height: 72px; object-fit: contain; }
.quality-picker-item small { display: block; color: var(--muted); margin-top: 4px; }

.quality-picker-item > label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.quality-picker-item span { overflow-wrap: anywhere; }
.quality-picker-item[hidden] { display: none; }
.quality-picker-preview { width: min(1000px, 94vw); }
.quality-picker-preview img { display: block; width: 100%; max-height: 65vh; object-fit: contain; margin-bottom: 12px; }

/* Candidate checking: explain targets before selection controls. */
.quality-picker-dialog { width: min(780px, 94vw); height: min(840px, calc(100vh - 32px)); padding: 20px 24px; box-sizing: border-box; }
.quality-picker-dialog[open] { display: flex; flex-direction: column; }
.quality-picker-dialog h2 { margin: 0 0 20px; }
.quality-picker-intro { line-height: 1.8; }
.quality-picker-intro p { margin: 0 0 10px; }
.quality-picker-scope { color: var(--muted); font-size: 13px; line-height: 1.7; }
.quality-picker-safety { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; line-height: 1.7; }
.quality-picker-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin: 16px 0; }
.quality-picker-controls label { display: flex; align-items: center; gap: 8px; }
.quality-picker-controls [hidden] { display: none; }
.quality-picker-dialog > p { line-height: 1.7; }
.quality-picker-dialog .quality-picker-list { flex: 1; min-height: 90px; max-height: none; }
.quality-picker-dialog > p { margin: 8px 0; }
.quality-picker-dialog .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.quality-picker-targets { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 12px 0; list-style: none; }
.quality-picker-targets li { background: var(--pane-soft, rgba(255,255,255,.04)); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; }

/* 全体設定は共通の保存欄を維持し、用途ごとに切り替える。 */
#settingsDialog .settings-panel { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.global-settings-tabs { padding: 12px 16px; gap: 6px; }
.global-settings-tabs [role="tab"] { padding: 9px 6px; }
.global-settings-panel { display: grid; gap: 18px; min-width: 0; }
.global-settings-panel[hidden] { display: none; }
#settingsDialog .settings-footer { flex-wrap: wrap; }
#settingsDialog #settingsSaveStatus { flex: 1 1 180px; margin: 0; text-align: left; }

/* タブの内容量が変わっても、設定の見出しと本文を上に揃える。 */
#settingsDialog, #displayOptionsDialog { inset-block: 16px auto; margin-block: 0; }
#settingsDialog .settings-body, #displayOptionsDialog .settings-body,
.global-settings-panel { align-content: start; }

/* 中央ヘッダは操作・検索を一列に保ち、検索欄だけ幅に追従する。 */
.thumb-header { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 8px; }
.thumb-header > .pane-actions { display: contents; }
.thumb-header .right-toolbar-actions { order: 2; flex: 0 0 auto; margin-left: 0; }
.thumb-header > .filter-row { order: 1; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; padding-top: 0; border-top: 0; }
.thumb-header .filter-row .file-name-search { flex: 1 1 180px; min-width: 100px; max-width: none; }
.thumb-header .filter-row .file-name-search select { width: 70px; }
.thumb-header .filter-row .file-name-search input { width: 0; flex: 1 1 auto; padding-inline: 8px; }
.thumb-header > .pane-actions > .icon-button { flex: 0 0 auto; }
.browser-original-sorter { inset:0; margin:0; width:100vw; max-width:none; height:100vh; max-height:none; padding:0; border:0; overflow:auto; }

/* Header actions start beside the brand; help and settings stay at the end. */
.top-bar { justify-content: flex-start; }
.top-bar > .toolbar { flex: 1; justify-content: flex-start; min-width: 0; }
.top-bar > .toolbar > #tutorialButton { margin-left: auto; }
