.panel.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100vw, var(--detail-panel-width));
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  height: 100%;
  background: var(--surface);
  box-shadow: 0 0 24px var(--shadow-soft);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000000;
  overflow: visible;
}

.detail-panel.detail-panel--inline {
  position: relative;
  right: auto;
  top: auto;
  height: auto;
  min-height: 100%;
  z-index: auto;
  flex: 0 0 var(--detail-panel-width);
}

.detail-panel--resizing {
  cursor: col-resize;
  user-select: none;
}

.detail-panel__resize-handle {
  position: absolute;
  top: 0;
  left: -0.6rem;
  width: 1.2rem;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
}

.detail-panel__resize-handle span {
  width: 2px;
  height: 100%;
  border-radius: 999px;
  background: transparent;
  transition: background 120ms ease;
}

.detail-panel__resize-handle:hover span,
.detail-panel__resize-handle:focus-visible span,
.detail-panel__resize-handle.is-active span {
  background: var(--border);
}

.detail-panel__resize-handle:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--border) 80%, transparent);
  outline-offset: 2px;
  border-radius: 999px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  min-width: 0;
  flex-shrink: 0;
}

.panel-header .icon {
  width: 1.35rem;
  height: 1.35rem;
}

.panel-header__leading,
.panel-header__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.panel-header__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  text-wrap: nowrap;
}

.panel-header>.panel-header__title:first-child {
  padding-left: 0.5rem;
}

.panel-header__actions {
  margin-left: auto;
}

.panel-body {
  padding: 0.5rem 1rem;
}


.detail-panel .panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.detail-panel__content {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.detail-panel__content .document-viewer-panel {
  flex: 1;
}

.detail-section__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.detail-section__title {
  margin: 0;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.quick-add {
  --quick-add-menu-offset: 0.35rem;
  --quick-add-menu-min-width: 220px;
  display: inline-flex;
  align-items: center;
  position: relative;
}

.quick-add__trigger {
  white-space: nowrap;
}

.documents-sort__trigger.quick-add__trigger {
  padding: 0.25rem 0.5rem;
  min-height: 2.1rem;
}

.quick-add__chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-size: 0.85rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  min-width: 0;
  flex: 1 1 9rem;
  max-width: 12rem;
  overflow: hidden;
}

.quick-add__chip:hover,
.quick-add__chip:focus-visible {
  border-style: solid;
  background: var(--selection-soft);
  color: var(--fg);
  outline: none;
}

.quick-add__chip .icon-inline {
  width: 1rem;
  height: 1rem;
}

.quick-add__chip-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 0;
}

.quick-add__chip-label .icon-inline {
  flex-shrink: 0;
}

.quick-add__chip-text {
  display: inline-block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-add__form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.quick-add__form input {
  flex: 1;
  min-width: 0;
}

.quick-add__list {
  max-height: 240px;
  overflow-y: auto;
}

.quick-add__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quick-add__swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
}

.selection-assignment {
  display: inline-flex;
  position: relative;
}

.selection-assignment__menu {
  font-size: 0.95rem;
  font-weight: 400;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  max-width: min(22rem, 90vw);
}

.selection-assignment__header {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.selection-assignment__form {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}

.selection-assignment__form input {
  flex: 1 1 auto;
  width: 100%;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  background: var(--surface-subtle);
  color: var(--fg);
  font-size: 0.95rem;
}

.selection-assignment__form input:focus-visible {
  outline: none;
  border-color: color-mix(in oklch, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 35%, transparent);
}

.selection-assignment__add {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
}

.selection-assignment__list {
  max-height: max(240px, 50vh);
  overflow-y: auto;
  padding: 0 0.25rem 0.25rem;
  scrollbar-gutter: stable;
}

.selection-assignment__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 400;
  box-sizing: border-box;
}

.selection-assignment__label {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.selection-assignment__spinner {
  margin-left: 0.4rem;
}

.selection-assignment__label--nowrap {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-assignment__indent {
  display: inline-block;
  flex: 0 0 auto;
}

.selection-assignment__folder-label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  max-width: 16rem;
}

.selection-assignment__folder-name {
  font-weight: 500;
  color: var(--fg);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-assignment__folder-path {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: normal;
  word-break: break-word;
}

.selection-assignment__slash {
  color: var(--muted);
  margin: 0 0.25rem;
}

.selection-assignment__segment {
  display: inline-block;
}

.selection-assignment__item--all .selection-assignment__icon {
  color: var(--success);
}

.selection-assignment__item--partial .selection-assignment__icon {
  color: var(--warning);
}

.selection-assignment__icon {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.selection-assignment__icon--empty {
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  opacity: 0.6;
}

.selection-assignment__label {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  font-weight: 400;
}

.selection-assignment__count {
  font-size: 0.8rem;
  color: var(--muted);
}

.selection-assignment__empty {
  padding: 0.75rem;
}

.selection-assignment__create {
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


.preview-pane {
  margin-top: 0.4rem;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 0;
  flex: 1;
  overflow: auto;
  position: relative;
  padding: 1.25rem;
}

.preview-pane__media {
  border-radius: 0;
  background: transparent;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  position: relative;
}

.preview-image {
  width: 100%;
  max-width: 360px;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: auto;
  position: relative;
}

.preview-image__content {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
  cursor: pointer;
  transition:
    outline-color 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease,
    background-color 120ms ease;
  outline: 2px solid transparent;
  outline-offset: -2px;
}

.preview-image__content:hover,
.preview-image__content:focus-visible {
  outline-color: var(--accent-focus);
  box-shadow:
    inset 0 0 0 999px var(--accent-elevated),
    0 6px 18px var(--accent-elevated-strong);
}

.thumbnail-preview {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  margin: 0.4rem 0 0.6rem;
}

.thumbnail-image {
  max-width: 100%;
  border-radius: 0;
  box-shadow: none;
}

.detail-panel .meta,
.document-summary .meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.5rem 0;
}

.detail-panel .detail-folder-path,
.document-summary .detail-folder-path {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.detail-folder-path--block {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.5rem 0;
}

.detail-panel .detail-folder-path__link,
.document-summary .detail-folder-path__link {
  color: var(--accent);
  text-decoration: none;
}

.detail-panel .detail-folder-path__link:hover,
.detail-panel .detail-folder-path__link:focus-visible,
.document-summary .detail-folder-path__link:hover,
.document-summary .detail-folder-path__link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.detail-panel .detail-folder-path__separator,
.document-summary .detail-folder-path__separator {
  color: var(--muted);
}

.detail-panel .detail-folder-path__segment,
.document-summary .detail-folder-path__segment {
  color: var(--fg);
}

.detail-panel .doc-title-row,
.document-summary .doc-title-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.25rem 0 1.25rem;
  max-width: 100%;
  word-break: break-word;
}

.doc-title-row__primary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}

.doc-title-row__title {
  margin: 0;
}

.doc-title-row__path {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}


.document-summary--compact {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.document-summary__title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.document-summary__meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.document-summary__meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.document-summary__meta-label {
  color: var(--muted);
}

.document-summary__meta-value {
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.document-summary__meta-value .detail-meta__value {
  font-size: inherit;
  color: inherit;
}

.document-summary__section {
  padding: 0;
}

.tag-list.document-summary__tags,
.correspondent-list.document-summary__correspondents {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.document-summary__details {}

.document-summary__details-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.document-summary__details-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding: 0.75rem 0;
}

.document-summary__details-row dt {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

.document-summary__details-row dd {
  margin: 0;
  word-break: break-word;
  text-align: right;
  flex: 1 1 auto;
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.document-summary__details-row .icon-button {
  margin: -0.25rem 0;
}

.detail-panel .doc-title-edit,
.document-summary .doc-title-edit {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}

.document-summary__details-row .doc-title-edit,
.document-summary__details-row .doc-title-edit--inline {
  width: auto;
  flex: 1 1 auto;
}

.doc-title-edit--inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: auto;
}

.doc-title-edit--inline input {
  width: auto;
  min-width: 8rem;
}

.detail-panel .doc-title-edit input,
.document-summary .doc-title-edit input {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}

.detail-panel .doc-title-edit input:focus-visible,
.document-summary .doc-title-edit input:focus-visible {
  outline: 2px solid var(--selection-ring);
  outline-offset: 1px;
}

.status-inline {
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 1rem 0;
}

.detail-meta__row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.detail-meta__label {
  font-weight: 600;
  color: var(--fg);
}

.detail-meta__value {
  color: var(--fg);
}

.detail-meta__row>.icon-button {
  margin: -0.25rem;
}

.doc-issued-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.25rem 0 0.5rem;
}

.doc-issued-row__label {
  font-weight: 600;
  color: var(--fg);
}

.doc-issued-row__value {
  color: var(--fg);
}

.doc-issued-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.doc-issued-edit input[type='date'] {
  font: inherit;
  padding: 0.35rem 0.5rem;
}

.status-inline.error {
  color: var(--danger);
}

.bulk-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.6rem 0;
}

.bulk-detail-actions .inline {
  display: flex;
  gap: 0.4rem;
}

.bulk-move {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.6rem 0;
}

.selection-assignment__header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.selection-assignment__nav-title .icon-button {
  margin-left: -0.25rem;
}

.selection-assignment__nav-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}

.selection-assignment__nav-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.selection-assignment__item-content {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.selection-assignment__item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.menu .selection-assignment__item--empty:hover,
.menu .selection-assignment__item--empty:focus-visible {
  background: transparent;
  cursor: default;
}

.selection-assignment__item--empty .selection-assignment__item-content {
  opacity: 0.5;
  cursor: default;
}