/* Dokumente: file library, quick requests, submissions and their management.
   Built on the Liquid Glass tokens (liquid.css loads after this file and keeps inputs,
   focus rings and the header type). Colour carries meaning only: file types, request
   icons and status. Status is always written out as text as well. */

/* ── Tokens ─────────────────────────────────────────────── */
:is(.documents-page, .doc-dialog) {
  --doc-ink-2: rgba(255, 255, 255, 0.64);
  --doc-line: rgba(255, 255, 255, 0.08);
  --doc-line-strong: rgba(255, 255, 255, 0.16);
  --doc-hover: rgba(255, 255, 255, 0.05);
  --doc-field: rgba(255, 255, 255, 0.06);
  --doc-soft: rgba(255, 255, 255, 0.04);
  --doc-control: rgba(255, 255, 255, 0.08);
  --doc-control-hover: rgba(255, 255, 255, 0.14);
  --doc-track: rgba(0, 0, 0, 0.22);
  --doc-segment: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.1)
  );
  --doc-error: #ff8a95;
  --doc-focus: #ff6272;
}
body.theme-light :is(.documents-page, .doc-dialog) {
  --doc-ink-2: #4b5870;
  --doc-line: rgba(15, 23, 42, 0.08);
  --doc-line-strong: rgba(15, 23, 42, 0.16);
  --doc-hover: rgba(15, 23, 42, 0.04);
  --doc-field: #f4f6fa;
  --doc-soft: rgba(15, 23, 42, 0.03);
  --doc-control: #fff;
  --doc-control-hover: #f3f5f9;
  --doc-track: rgba(15, 23, 42, 0.06);
  --doc-segment: #fff;
  --doc-error: #c4142c;
  --doc-focus: #e0203a;
}
.tone-green {
  --tone: #30d158;
}
.tone-blue {
  --tone: #0a84ff;
}
.tone-violet {
  --tone: #bf5af2;
}
.tone-cyan {
  --tone: #32ade6;
}
.tone-amber {
  --tone: #ff9f0a;
}
.tone-orange {
  --tone: #ff7a1a;
}
.tone-yellow {
  --tone: #ffcc00;
}
.tone-indigo {
  --tone: #7d7aff;
}
.tone-rose {
  --tone: #ff375f;
}
.tone-pink {
  --tone: #ff5fb0;
}
.tone-red {
  --tone: #ff453a;
}
.tone-slate {
  --tone: #98989f;
}
.doc-type-pdf {
  --tone: #ff453a;
}
.doc-type-word {
  --tone: #0a84ff;
}
.doc-type-excel {
  --tone: #30d158;
}
.doc-type-image {
  --tone: #bf5af2;
}
.doc-type-text {
  --tone: #98989f;
}
.doc-type-folder {
  --tone: #ff9f0a;
}
[data-status="submitted"] {
  --tone: #0a84ff;
}
[data-status="approved"] {
  --tone: #30d158;
}
[data-status="rejected"] {
  --tone: #ff453a;
}

/* ── Page frame ─────────────────────────────────────────── */
.documents-page {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
  color: var(--text);
  height: 100dvh;
  overflow-y: scroll;
  overflow-x: hidden;
}
:is(.documents-page, .doc-dialog) *,
:is(.documents-page, .doc-dialog) *::before,
:is(.documents-page, .doc-dialog) *::after {
  box-sizing: border-box;
}
:is(.documents-page, .doc-dialog) [hidden] {
  display: none !important;
}
:is(.documents-page, .doc-dialog) :is(h2, h3, p) {
  margin: 0;
}
.documents-page h2,
.doc-dialog h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}
:is(.documents-page, .doc-dialog) h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
:is(.documents-page, .doc-dialog) svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.doc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.doc-muted,
.doc-hint {
  color: var(--doc-ink-2);
}
.doc-hint {
  font-size: 12.5px;
  line-height: 1.55;
}
.doc-error {
  color: var(--doc-error);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}
.doc-header > div {
  min-width: 0;
}
.doc-header h1 {
  margin: 8px 0;
}
.doc-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.doc-status-bar:has(.doc-status:not(:empty)),
.doc-status-bar:has(button:not([hidden])) {
  margin-bottom: 24px;
}
.doc-status {
  color: var(--doc-ink-2);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.doc-status:empty {
  display: none;
}
.doc-status.is-error {
  color: var(--doc-error);
}
.doc-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
.doc-section-heading p {
  max-width: 64ch;
  margin-top: 6px;
  color: var(--doc-ink-2);
  font-size: 14px;
  line-height: 1.55;
}

/* ── Controls ───────────────────────────────────────────── */
:is(.documents-page, .doc-dialog) :is(button, .doc-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--doc-control);
  color: var(--text);
  box-shadow:
    inset 0 0 0 1px var(--doc-line-strong),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.2s var(--ease-smooth),
    box-shadow 0.2s var(--ease-smooth),
    transform 0.2s var(--ease-smooth),
    opacity 0.2s;
}
body.theme-light :is(.documents-page, .doc-dialog) :is(button, .doc-button) {
  border: 0;
  background: var(--doc-control);
  color: var(--text);
  box-shadow:
    inset 0 0 0 1px var(--doc-line-strong),
    0 1px 2px rgba(15, 23, 42, 0.05);
}
/* :where keeps hover below state rules (pressed chip, selected tab), which would otherwise lose their fill */
:where(.documents-page, .doc-dialog)
  :where(button, .doc-button):hover:not(:disabled) {
  background: var(--doc-control-hover);
  filter: none;
  transform: none;
}
/* app.css strokes every light-theme svg path grey and rings every focused element, also after a mouse click */
body.theme-light
  :is(.documents-page, .doc-dialog)
  svg
  :is(path, line, circle, rect, ellipse) {
  stroke: currentColor;
}
body.theme-light
  :is(.documents-page, .doc-dialog)
  :is(button, .doc-button):focus:not(:focus-visible) {
  box-shadow:
    inset 0 0 0 1px var(--doc-line-strong),
    0 1px 2px rgba(15, 23, 42, 0.05);
}
body.theme-light
  :is(.documents-page, .doc-dialog)
  .doc-primary:focus:not(:focus-visible) {
  box-shadow: var(--primary-glow);
}
body.theme-light
  :is(.documents-page, .doc-dialog)
  :is(
    summary,
    .doc-ghost,
    .doc-segments button,
    .doc-chips button,
    .doc-breadcrumb button,
    button.doc-row-title,
    [tabindex="-1"]
  ):focus:not(:focus-visible) {
  box-shadow: none;
}
body.theme-light
  .documents-page
  .doc-segments
  button[aria-selected="true"]:focus:not(:focus-visible) {
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.04);
}
body.theme-light
  .documents-page
  button.doc-quick-card:focus:not(:focus-visible) {
  box-shadow: var(--shadow-card);
}
body.theme-light
  :where(.documents-page, .doc-dialog)
  :where(button, .doc-button):hover:not(:disabled) {
  background: var(--doc-control-hover);
}
:is(.documents-page, .doc-dialog)
  :is(button, .doc-button, summary, a):focus-visible {
  outline: 2px solid var(--doc-focus);
  outline-offset: 2px;
}
:is(.documents-page, .doc-dialog) button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
:is(.documents-page, .doc-dialog) button::after {
  display: none;
}
:is(.documents-page, .doc-dialog) .doc-primary,
body.theme-light :is(.documents-page, .doc-dialog) .doc-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--primary-glow);
  font-weight: 650;
}
:is(.documents-page, .doc-dialog) .doc-primary:hover:not(:disabled),
body.theme-light
  :is(.documents-page, .doc-dialog)
  .doc-primary:hover:not(:disabled) {
  background: var(--gradient-brand);
  box-shadow: var(--primary-glow-strong);
  filter: brightness(1.04);
}
:is(.documents-page, .doc-dialog) .doc-danger {
  color: var(--doc-error);
}
:is(.documents-page, .doc-dialog) .doc-icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
}
:is(.documents-page, .doc-dialog) .doc-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}
:is(.documents-page, .doc-dialog) .doc-small.doc-icon-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
}
:is(.documents-page, .doc-dialog) .doc-ghost {
  background: transparent;
  box-shadow: none;
}
body.theme-light :is(.documents-page, .doc-dialog) .doc-ghost {
  background: transparent;
  box-shadow: none;
}
:is(.documents-page, .doc-dialog) .doc-ghost:hover:not(:disabled) {
  background: var(--doc-hover);
}
/* :where keeps the :not() chain from outranking component rules such as the search field */
:is(.documents-page, .doc-dialog)
  :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select,
    textarea
  ) {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
}
:is(.documents-page, .doc-dialog) input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
:is(.documents-page, .doc-dialog)
  input[type="number"]::-webkit-inner-spin-button,
:is(.documents-page, .doc-dialog)
  input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}
/* Native selects (dialogs, phones) get the same chevron as the custom select */
:is(.documents-page, .doc-dialog) select {
  padding-right: 42px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='.6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
body.theme-light :is(.documents-page, .doc-dialog) select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5870' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
:is(.documents-page, .doc-dialog) textarea {
  min-height: 96px;
  line-height: 1.5;
  resize: vertical;
}
:is(.documents-page, .doc-dialog) :is(input, textarea)::placeholder {
  color: var(--doc-ink-2);
  opacity: 0.8;
}
:is(.documents-page, .doc-dialog) select option {
  background: #161827;
  color: #fff;
}
body.theme-light :is(.documents-page, .doc-dialog) select option {
  background: #fff;
  color: #0f172a;
}
.doc-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.doc-field > span em {
  margin-left: 6px;
  color: var(--doc-ink-2);
  font-style: normal;
  font-weight: 500;
}
.doc-field .doc-hint {
  font-weight: 400;
}
.doc-field .c-select__trigger {
  min-height: 46px;
}
.doc-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.doc-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #ff3347;
}
.doc-fieldset {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.doc-fieldset > legend {
  margin-bottom: 10px;
  padding: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.doc-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
/* app.css paints every light-theme list white with a grey hover; these lists bring their own surfaces */
body.theme-light :is(.documents-page, .doc-dialog) :is(ul, ol, li) {
  background: transparent;
}
body.theme-light
  :is(.documents-page, .doc-dialog)
  :is(.doc-picked li, .doc-field-editor) {
  background: var(--doc-soft);
}

/* Switch: a checkbox in iOS form */
.doc-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.doc-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.doc-switch-track {
  position: relative;
  width: 46px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--doc-track);
  box-shadow: inset 0 0 0 1px var(--doc-line-strong);
  transition: background 0.25s var(--ease-smooth);
}
.doc-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: translate 0.3s var(--ease-spring);
}
.doc-switch input:checked + .doc-switch-track {
  background: #30d158;
  box-shadow: none;
}
.doc-switch input:checked + .doc-switch-track::after {
  translate: 18px 0;
}
.doc-switch input:focus-visible + .doc-switch-track {
  outline: 2px solid var(--doc-focus);
  outline-offset: 2px;
}

/* Pill choice built from radios */
.doc-choice {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  padding: 4px;
  border-radius: 999px;
  background: var(--doc-track);
  box-shadow: inset 0 0 0 1px var(--doc-line);
}
.doc-choice label {
  position: relative;
  cursor: pointer;
}
.doc-choice input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.doc-choice span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--doc-ink-2);
  font-size: 13.5px;
  font-weight: 600;
  transition:
    background 0.2s,
    color 0.2s;
}
.doc-choice input:checked + span {
  background: var(--doc-segment);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 12px -6px rgba(0, 0, 0, 0.5);
}
body.theme-light .doc-choice input:checked + span {
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.04);
}
.doc-choice input:focus-visible + span {
  outline: 2px solid var(--doc-focus);
  outline-offset: 2px;
}

/* ── Segments, toolbar, search ──────────────────────────── */
.doc-segments {
  display: flex;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  margin-bottom: 34px;
  padding: 5px;
  overflow-x: auto;
  border-radius: 999px;
  background: var(--doc-track);
  box-shadow: inset 0 0 0 1px var(--doc-line);
  scrollbar-width: none;
}
.doc-segments::-webkit-scrollbar {
  display: none;
}
.documents-page .doc-segments button,
body.theme-light .documents-page .doc-segments button {
  min-height: 40px;
  padding: 0 18px;
  flex-shrink: 0;
  background: transparent;
  box-shadow: none;
  color: var(--doc-ink-2);
  font-size: 14px;
}
.documents-page
  .doc-segments
  button:not([aria-selected="true"]):hover:not(:disabled) {
  background: transparent;
  color: var(--text);
}
.documents-page .doc-segments button[aria-selected="true"],
body.theme-light .documents-page .doc-segments button[aria-selected="true"] {
  background: var(--doc-segment);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 8px 20px -10px rgba(0, 0, 0, 0.7);
}
body.theme-light .documents-page .doc-segments button[aria-selected="true"] {
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.04);
}
.doc-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--doc-control-hover);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.doc-count.is-urgent {
  background: var(--gradient-brand);
  color: #fff;
}
.doc-panel {
  min-width: 0;
}
.doc-panel:not(:has(.doc-submit-layout, .doc-quick-grid)) {
  margin: 16px 0 28px;
  padding: 26px;
  border-radius: 24px;
  background: var(--liquid-fill);
  box-shadow: var(--shadow-card);
}
body.theme-light .doc-panel:not(:has(.doc-submit-layout, .doc-quick-grid)) {
  background: var(--liquid-fill), #fff;
}
.doc-panel.revealed:not(:has(.doc-submit-layout, .doc-quick-grid)) {
  border-radius: 24px;
}
.doc-panel:not(:has(.doc-submit-layout, .doc-quick-grid)) .doc-surface {
  background: transparent;
  box-shadow: none;
}
.doc-panel.revealed {
  margin: 16px 0 28px;
  padding: 26px;
  border-radius: 24px;
  background: var(--liquid-fill);
  box-shadow: var(--shadow-card);
}
body.theme-light .doc-panel.revealed {
  background: var(--liquid-fill), #fff;
}
.doc-panel.revealed .doc-surface {
  background: transparent;
  box-shadow: none;
}
.doc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 20px;
  margin-bottom: 20px;
}
.doc-toolbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}
.doc-search {
  position: relative;
  display: block;
  width: 280px;
  max-width: 100%;
}
.doc-search svg {
  position: absolute;
  top: 50%;
  left: 16px;
  z-index: 1;
  translate: 0 -50%;
  color: var(--doc-ink-2);
  pointer-events: none;
}
.documents-page .doc-search input {
  min-height: 42px;
  padding-left: 44px;
  border-radius: 999px;
}
.doc-select {
  display: block;
  min-width: 170px;
}
.documents-page .doc-select :is(select, .c-select__trigger) {
  min-height: 42px;
  border-radius: 999px;
}
.doc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.documents-page .doc-chips button,
body.theme-light .documents-page .doc-chips button,
.doc-dialog .doc-chips button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}
:is(.documents-page, .doc-dialog) .doc-chips button[aria-pressed="true"],
body.theme-light
  :is(.documents-page, .doc-dialog)
  .doc-chips
  button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  box-shadow: none;
}
.doc-summary {
  min-height: 20px;
  margin: 4px 0 16px;
  color: var(--doc-ink-2);
  font-size: 13px;
}
.doc-summary:empty {
  display: none;
}

.doc-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.doc-breadcrumb li {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.doc-breadcrumb li + li::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: var(--doc-ink-2);
  opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.documents-page .doc-breadcrumb button,
body.theme-light .documents-page .doc-breadcrumb button {
  min-height: 36px;
  padding: 0 10px;
  background: transparent;
  box-shadow: none;
  color: var(--doc-ink-2);
  font-size: 14px;
}
.documents-page .doc-breadcrumb button:hover:not(:disabled) {
  background: var(--doc-hover);
  color: var(--text);
}
.doc-breadcrumb [aria-current] {
  padding: 0 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* ── Surfaces and rows ──────────────────────────────────── */
.doc-surface {
  position: relative;
  min-width: 0;
  border-radius: 24px;
  background: var(--liquid-fill);
  box-shadow: var(--shadow-card);
}
body.theme-light .doc-surface {
  background: var(--liquid-fill), #fff;
}
.doc-list {
  display: grid;
  gap: 4px;
  padding: 10px;
}
.doc-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 15px 18px;
  border-radius: 16px;
  transition: background 0.2s var(--ease-smooth);
}
.doc-row:hover,
.doc-row:focus-within {
  background: var(--doc-hover);
}
.doc-row.is-folder {
  cursor: pointer;
}
.doc-row.is-muted .doc-row-title {
  color: var(--doc-ink-2);
}
.doc-row-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.doc-row-title {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.documents-page button.doc-row-title,
body.theme-light .documents-page button.doc-row-title {
  display: inline;
  justify-self: start;
  min-height: 0;
  padding: 0;
  border-radius: 4px;
  background: none;
  box-shadow: none;
  text-align: left;
  white-space: normal;
}
.documents-page button.doc-row-title:hover:not(:disabled) {
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.doc-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  color: var(--doc-ink-2);
  font-size: 12.5px;
  line-height: 1.5;
}
.doc-row-meta > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.doc-row-meta > span:not(.doc-chip):has(+ span:not(.doc-chip))::after {
  content: "·";
  margin: 0 8px;
  opacity: 0.7;
}
.doc-row-meta > .doc-chip {
  margin-left: 8px;
}
.doc-row-meta > .doc-chip:first-child {
  margin-left: 0;
}
.doc-row-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--doc-ink-2);
  font-size: 13px;
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.doc-row-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.doc-row-chevron {
  display: grid;
  place-items: center;
  color: var(--doc-ink-2);
}
/* Secondary row tools appear with the row on pointer devices; touch and keyboard always reach them */
@media (hover: hover) and (pointer: fine) {
  .doc-row .doc-row-actions .doc-ghost {
    opacity: 0;
    transition: opacity 0.2s var(--ease-smooth);
  }
  .doc-row:hover .doc-row-actions .doc-ghost,
  .doc-row:focus-within .doc-row-actions .doc-ghost {
    opacity: 1;
  }
}
.doc-row-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.doc-tile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--tone, #98989f) 16%, transparent);
  color: var(--tone, #98989f);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--tone, #98989f) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}
.doc-tile svg {
  width: 22px;
  height: 22px;
}
.doc-tile.doc-type-folder svg {
  fill: color-mix(in srgb, var(--tone, #98989f) 30%, transparent);
}
body.theme-light .doc-tile {
  background: color-mix(in srgb, var(--tone, #98989f) 12%, #fff);
  color: color-mix(in srgb, var(--tone, #98989f) 72%, #000);
  box-shadow: inset 0 0 0 1px
    color-mix(in srgb, var(--tone, #98989f) 22%, transparent);
}
.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, #98989f) 16%, transparent);
  color: color-mix(in srgb, var(--tone, #98989f) 70%, #fff);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}
body.theme-light .doc-chip {
  background: color-mix(in srgb, var(--tone, #98989f) 12%, #fff);
  color: color-mix(in srgb, var(--tone, #98989f) 70%, #000);
}
.doc-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, #98989f) 15%, transparent);
  color: color-mix(in srgb, var(--tone, #98989f) 65%, #fff);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.doc-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tone, #98989f);
}
body.theme-light .doc-pill {
  background: color-mix(in srgb, var(--tone, #98989f) 11%, #fff);
  color: color-mix(in srgb, var(--tone, #98989f) 70%, #000);
}

.doc-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0;
  padding: 52px 24px;
  color: var(--doc-ink-2);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}
.doc-empty strong {
  color: var(--text);
  font-size: 15.5px;
  font-weight: 700;
}
.doc-empty .doc-tile {
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  border-radius: 16px;
}
.doc-empty .doc-tile svg {
  width: 24px;
  height: 24px;
}
.doc-empty > span:not(.doc-tile) {
  max-width: 46ch;
}
.doc-list-hint {
  margin-top: 14px;
  text-align: center;
}
.doc-droptarget.is-over {
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 2px #ff3347;
}
.doc-droptarget.is-over::after {
  content: "Zum Hochladen loslassen";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: color-mix(in srgb, #ff3347 12%, transparent);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  pointer-events: none;
}

/* ── Quick requests ─────────────────────────────────────── */
.doc-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}
.doc-quick-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-width: 0;
  min-height: 196px;
  padding: 22px;
  border-radius: 24px;
  background: var(--liquid-fill);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-align: left;
}
body.theme-light .doc-quick-card {
  background: var(--liquid-fill), #fff;
}
.documents-page button.doc-quick-card,
body.theme-light .documents-page button.doc-quick-card {
  display: grid;
  align-items: start;
  justify-items: start;
  min-height: 196px;
  padding: 22px;
  border-radius: 24px;
  background: var(--liquid-fill);
  box-shadow: var(--shadow-card);
  white-space: normal;
  transition:
    transform 0.45s var(--ease-spring),
    box-shadow 0.3s var(--ease-smooth);
}
body.theme-light .documents-page button.doc-quick-card {
  background: var(--liquid-fill), #fff;
}
.documents-page button.doc-quick-card:hover:not(:disabled),
body.theme-light .documents-page button.doc-quick-card:hover:not(:disabled) {
  transform: translateY(-3px);
  background: var(--liquid-fill);
  box-shadow: var(--shadow-card-hover);
}
body.theme-light .documents-page button.doc-quick-card:hover:not(:disabled) {
  background: var(--liquid-fill), #fff;
}
.doc-quick-card .doc-tile {
  width: 48px;
  height: 48px;
  border-radius: 15px;
}
.doc-quick-body {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.doc-quick-body strong {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.doc-quick-body > span {
  color: var(--doc-ink-2);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.doc-quick-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  color: var(--doc-ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.doc-quick-foot svg {
  width: 16px;
  height: 16px;
}
.doc-quick-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
}
.doc-quick-card.is-new {
  align-content: center;
  justify-items: center;
  text-align: center;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--doc-line-strong);
}
.documents-page button.doc-quick-card.is-new,
body.theme-light .documents-page button.doc-quick-card.is-new {
  align-content: center;
  justify-items: center;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--doc-line-strong);
  border: 0;
  outline-offset: 2px;
}
.documents-page button.doc-quick-card.is-new:hover:not(:disabled) {
  background: var(--doc-hover);
  box-shadow: inset 0 0 0 1.5px var(--doc-line-strong);
}
.doc-quick-card.is-paused .doc-tile {
  filter: grayscale(1);
  opacity: 0.6;
}
.doc-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  padding-top: 14px;
  border-top: 1px solid var(--doc-line);
}

/* ── Travel calculation and agreed employee rates ───────── */
.doc-travel-address-status { min-height: 18px; color: var(--doc-ink-2); font-size: 12px; font-weight: 400; line-height: 1.5; }
.doc-address-suggestions { margin: 0; padding: 4px; list-style: none; max-height: 220px; overflow-y: auto; border: 1px solid var(--doc-line-strong); border-radius: 16px; background: var(--doc-soft); }
:is(.doc-dialog, body.theme-light .doc-dialog) .doc-address-suggestions button { width: 100%; min-height: 44px; padding: 12px; border: 0; border-radius: 12px; background: transparent; box-shadow: none; text-align: left; white-space: normal; overflow-wrap: anywhere; font-size: 13px; font-weight: 500; line-height: 1.5; }
.doc-dialog .doc-address-suggestions button:hover { background: var(--doc-hover); }
#documents-travel-route-status a { color: var(--doc-ink-2); text-decoration: underline; text-underline-offset: 3px; }
.doc-travel-submit { --gradient-brand: linear-gradient(180deg, color-mix(in srgb, var(--primary) 82%, #000), color-mix(in srgb, var(--primary) 76%, #000)); --primary-glow: 0 4px 12px var(--primary-subtle); --primary-glow-strong: 0 6px 16px var(--primary-subtle); }
.doc-dialog .doc-travel-return { min-height: 48px; padding: 12px 16px; border: 1px solid var(--doc-line-strong); border-radius: 16px; background: var(--doc-soft); }
.doc-dialog .doc-travel-return:has(input:checked) { background: var(--primary-subtle); border-color: var(--border-primary); }
.doc-dialog .doc-travel-return input { width: 20px; height: 20px; }
.doc-travel-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 20px 0; border-block: 1px solid var(--doc-line); }
.doc-travel-metrics dt { color: var(--doc-ink-2); font-size: 12px; line-height: 1.5; }
.doc-travel-metrics dd { margin: 6px 0 0; color: var(--text); font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#documents-forms-panel { padding: 26px; border-radius: 24px; }
.documents-page [data-travel-rate-edit] { width: 44px; min-height: 44px; }
@media (max-width: 900px) { #documents-forms-panel { padding: 22px; } }
@media (max-width: 600px) { #documents-forms-panel { padding: 16px; border-radius: 20px; } }

/* ── Submit form and drafts ─────────────────────────────── */
.doc-submit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 28px;
  align-items: start;
  margin: 16px 0 28px;
  padding: 26px;
  border-radius: 24px;
  background: var(--liquid-fill);
  box-shadow: var(--shadow-card);
}
body.theme-light .doc-submit-layout {
  background: var(--liquid-fill), #fff;
}
.doc-submit-layout > :is(.doc-form, .doc-aside) {
  background: transparent;
  box-shadow: none;
}
.doc-form {
  padding: 32px;
}
.doc-form > fieldset {
  display: grid;
  gap: 20px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.doc-form-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 30px;
}
.doc-form-head p {
  margin-top: 6px;
  color: var(--doc-ink-2);
  font-size: 14px;
  line-height: 1.55;
}
.doc-form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 4px;
}
.doc-recipient {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--doc-ink-2);
  font-size: 13px;
  line-height: 1.45;
}
.doc-recipient:empty {
  display: none;
}
.doc-recipient strong {
  color: var(--text);
  font-weight: 650;
}
.doc-aside {
  display: grid;
  gap: 8px;
  padding: 24px;
}
.doc-aside h2 {
  font-size: 17px;
}
.doc-aside > p {
  font-size: 13.5px;
  line-height: 1.55;
}
.doc-mini-list {
  display: grid;
  gap: 2px;
  margin: 8px -10px -10px;
}
.doc-mini {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
}
.doc-mini:hover {
  background: var(--doc-hover);
}
.doc-mini .doc-tile {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 9.5px;
}
.doc-mini .doc-row-title {
  font-size: 14px;
}
.doc-mini-list .doc-empty {
  padding: 24px 10px;
  font-size: 13px;
}

.doc-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  padding: 18px 20px;
  border: 1.5px dashed var(--doc-line-strong);
  border-radius: 20px;
  background: var(--doc-soft);
  transition:
    border-color 0.2s,
    background 0.2s;
}
.doc-drop input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.doc-drop:hover,
.doc-drop.is-over {
  border-color: #ff3347;
  background: color-mix(in srgb, #ff3347 7%, transparent);
}
.doc-drop:focus-within {
  outline: 2px solid var(--doc-focus);
  outline-offset: 2px;
}
.doc-drop-art {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 15px;
  background: color-mix(in srgb, #ff3347 14%, transparent);
  color: var(--eyebrow);
}
.doc-drop-art svg {
  width: 22px;
  height: 22px;
}
.doc-drop-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.doc-drop-text strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}
.doc-drop-text span {
  color: var(--doc-ink-2);
  font-size: 12.5px;
  line-height: 1.5;
}
.doc-picked {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.doc-picked:empty {
  display: none;
}
.doc-picked li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px 8px 8px 10px;
  border-radius: 14px;
  background: var(--doc-soft);
  box-shadow: inset 0 0 0 1px var(--doc-line);
}
.doc-picked .doc-tile {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 9.5px;
}
.doc-picked-name {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
}
.doc-picked-name > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-picked-name small {
  color: var(--doc-ink-2);
  font-size: 12px;
  font-weight: 500;
}
.doc-picked li[data-state="done"] small {
  color: #30d158;
}
.doc-picked li[data-state="error"] small {
  color: var(--doc-error);
  white-space: normal;
}

/* ── Requests ───────────────────────────────────────────── */
.doc-request {
  min-width: 0;
  border-radius: 16px;
  transition: background 0.2s var(--ease-smooth);
}
.doc-request:hover,
.doc-request[open] {
  background: var(--doc-hover);
}
.doc-request > summary {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  cursor: pointer;
  list-style: none;
}
.doc-request > summary::-webkit-details-marker {
  display: none;
}
.doc-request-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.doc-amount {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.doc-request-chevron {
  display: grid;
  place-items: center;
  color: var(--doc-ink-2);
  transition: rotate 0.3s var(--ease-smooth);
}
.doc-request[open] .doc-request-chevron {
  rotate: 180deg;
}
.doc-request-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  padding: 6px 14px 20px 74px;
}
.doc-request-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.doc-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: 16px 24px;
  margin: 0;
}
.doc-facts dt {
  margin-bottom: 4px;
  color: var(--doc-ink-2);
  font-size: 12px;
  font-weight: 600;
}
.doc-facts dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.doc-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
:is(.documents-page, .doc-dialog) .doc-file-chip {
  min-height: 44px;
  max-width: 100%;
  padding: 0 14px 0 6px;
  gap: 10px;
  border-radius: 14px;
  white-space: normal;
  text-align: left;
}
.doc-file-chip .doc-tile {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 8.5px;
}
.doc-file-chip > span {
  display: grid;
  min-width: 0;
  overflow-wrap: anywhere;
}
.doc-file-chip small {
  color: var(--doc-ink-2);
  font-size: 11.5px;
  font-weight: 500;
}
.doc-review-result {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tone, #98989f) 10%, transparent);
  box-shadow: inset 0 0 0 1px
    color-mix(in srgb, var(--tone, #98989f) 24%, transparent);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.doc-review-result strong {
  font-size: 13px;
}
.doc-review-result p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.doc-review {
  display: grid;
  gap: 12px;
  max-width: 760px;
  padding: 16px;
  border-radius: 18px;
  background: var(--doc-soft);
  box-shadow: inset 0 0 0 1px var(--doc-line);
}
.doc-review fieldset {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.doc-review textarea {
  min-height: 72px;
}
.doc-review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Dialogs ────────────────────────────────────────────── */
.doc-dialog {
  width: min(600px, calc(100vw - 32px));
  max-width: none;
  max-height: min(880px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 28px;
  background: var(--liquid-sheet);
  color: var(--text);
  box-shadow: var(--shadow-modal);
  -webkit-backdrop-filter: var(--liquid-blur);
  backdrop-filter: var(--liquid-blur);
}
.doc-dialog[open] {
  display: flex;
  flex-direction: column;
}
.doc-dialog-wide {
  width: min(840px, calc(100vw - 32px));
}
.doc-dialog-small {
  width: min(460px, calc(100vw - 32px));
}
.doc-dialog::backdrop {
  background: rgba(4, 5, 12, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
body.theme-light .doc-dialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
}
.doc-dialog > form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.doc-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--doc-line);
}
.doc-dialog-head > div {
  flex: 1;
  min-width: 0;
}
.doc-dialog-head h2 {
  font-size: 19px;
  overflow-wrap: anywhere;
}
.doc-dialog-head p {
  margin-top: 4px;
  color: var(--doc-ink-2);
  font-size: 13.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.doc-dialog-head p:empty {
  display: none;
}
.doc-dialog-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 22px 24px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.doc-dialog-fields {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.doc-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--doc-line);
}
.doc-dialog-foot .doc-error {
  flex: 1 1 100%;
}
.doc-dialog-foot .doc-recipient {
  margin-right: auto;
}
.doc-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--doc-soft);
  box-shadow: inset 0 0 0 1px var(--doc-line);
  color: var(--doc-ink-2);
  font-size: 13.5px;
  font-weight: 600;
}
.doc-total strong {
  color: var(--text);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.doc-input-suffix {
  position: relative;
  display: block;
}
.doc-input-suffix > span {
  position: absolute;
  top: 50%;
  right: 16px;
  translate: 0 -50%;
  color: var(--doc-ink-2);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
:is(.documents-page, .doc-dialog) .doc-input-suffix input {
  padding-right: 64px;
}
.doc-scope {
  display: grid;
  gap: 12px;
}
.doc-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
  padding: 4px 4px 0;
}
.doc-checklist .doc-check {
  min-height: 40px;
  overflow-wrap: anywhere;
}

/* Form editor */
.doc-presets {
  display: grid;
  gap: 10px;
}
.doc-presets-label {
  color: var(--doc-ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.doc-editor-section {
  display: grid;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--doc-line);
}
.doc-editor-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}
.doc-editor-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.doc-editor-section-head .doc-muted {
  font-size: 12.5px;
}
.doc-icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.doc-icon-picker label {
  position: relative;
  cursor: pointer;
}
.doc-icon-picker input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.doc-icon-picker .doc-tile {
  transition:
    transform 0.25s var(--ease-spring),
    outline-color 0.2s;
  outline: 2px solid transparent;
  outline-offset: 3px;
}
.doc-icon-picker input:checked + .doc-tile {
  outline-color: var(--tone, #98989f);
}
.doc-icon-picker input:focus-visible + .doc-tile {
  outline-color: var(--doc-focus);
}
.doc-icon-picker label:hover .doc-tile {
  transform: translateY(-2px);
}
.doc-field-editors {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.doc-field-editor {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border-radius: 20px;
  background: var(--doc-soft);
  box-shadow: inset 0 0 0 1px var(--doc-line);
}
.doc-field-editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}
.doc-field-editor-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.doc-field-editor-tools {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.doc-field-editor .doc-check {
  min-height: 36px;
  font-size: 13.5px;
}
:is(.documents-page, .doc-dialog) .doc-add {
  justify-self: start;
}

/* ── PDF editor page shares this stylesheet ─────────────── */
.pdf-editor-page label:not(.doc-check) {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  color: var(--doc-ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.pdf-editor-page .pdf-tools button,
.pdf-editor-page .pdf-toolbar button,
.pdf-editor-page #pdf-download {
  white-space: normal;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .doc-submit-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .doc-aside {
    max-width: 720px;
  }
}
@media (max-width: 900px) {
  .documents-page { padding: 28px 28px 56px; }
  .doc-header {
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 26px;
  }
  .doc-segments {
    width: 100%;
    margin-bottom: 28px;
  }
  .documents-page .doc-segments button {
    flex: 1 0 auto;
    padding: 0 14px;
  }
  .doc-toolbar,
  .doc-toolbar-end {
    align-items: stretch;
  }
  .doc-toolbar-end {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .doc-search {
    flex: 1 1 220px;
    width: auto;
  }
  .doc-section-heading {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
  }
  .doc-panel.revealed { padding: 22px; }
  .doc-submit-layout { padding: 22px; }
  .doc-panel:not(:has(.doc-submit-layout, .doc-quick-grid)) { padding: 22px; }
  .documents-page .doc-search input {
    font-size: 16px;
  }
}
@media (max-width: 600px) {
  .documents-page { padding: 22px 16px 40px; }
  /* Four tabs become a 2 × 2 grid so none hides behind a scroll edge. Count buttons only: motion.js appends a
     gliding thumb span while switching. */
  .doc-segments:has(> button:nth-of-type(4)) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 24px;
  }
  .documents-page .doc-segments button {
    min-width: 0;
    padding: 0 8px;
    font-size: 13.5px;
    line-height: 1.15;
    white-space: normal;
  }
  .doc-toolbar > .doc-search {
    flex: 1 1 100%;
  }
  .doc-toolbar { gap: 10px; margin-bottom: 16px; }
  .doc-toolbar-end { gap: 8px; }
  .doc-panel.revealed { margin: 12px 0 20px; padding: 16px; border-radius: 20px; }
  .doc-submit-layout { margin: 12px 0 20px; padding: 16px; border-radius: 20px; }
  .doc-panel:not(:has(.doc-submit-layout, .doc-quick-grid)) { margin: 12px 0 20px; padding: 16px; border-radius: 20px; }
  .doc-list {
    gap: 4px;
    padding: 8px;
  }
  .doc-row {
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 14px 12px;
  }
  .doc-row .doc-tile,
  .doc-request .doc-tile {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }
  .doc-row:not(.is-folder) .doc-row-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
  .doc-row.is-folder {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
  }
  .doc-request > summary {
    grid-template-columns: 40px minmax(0, 1fr) 20px;
    align-items: start;
    gap: 14px;
    padding: 14px 12px;
  }
  .doc-request-chevron {
    padding-top: 10px;
  }
  .doc-request-side {
    grid-column: 2;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }
  .doc-request-chevron {
    grid-column: 3;
    grid-row: 1;
  }
  .doc-request-body {
    padding: 4px 10px 18px;
  }
  /* Panel already is the card on phones: nested surfaces go flat so content keeps its width. */
  body .doc-panel .doc-list,
  body .doc-submit-layout > .doc-surface {
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  body .doc-submit-layout > .doc-aside {
    padding-top: 24px;
    border-top: 1px solid var(--doc-line);
  }
  .doc-submit-layout .doc-mini-list { margin: 8px 0 0; }
  .doc-submit-layout { gap: 24px; }
  .doc-form-head {
    gap: 14px;
    margin-bottom: 20px;
  }
  .doc-grid-2,
  .doc-checklist,
  .doc-field-editor-top {
    grid-template-columns: minmax(0, 1fr);
  }
  .doc-form-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .doc-form-foot .doc-primary {
    width: 100%;
    min-height: 48px;
  }
  .doc-drop {
    min-height: 84px;
    padding: 16px;
  }
  .doc-select {
    flex: 1 1 100%;
  }
  .doc-toolbar-end > button {
    flex: 1 1 auto;
  }
  .doc-quick-card,
  .documents-page button.doc-quick-card {
    min-height: 0;
  }
  .doc-dialog,
  .doc-dialog-wide,
  .doc-dialog-small {
    width: 100%;
    max-height: calc(100dvh - 12px);
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
  }
  .doc-dialog-head {
    padding: 20px 18px 14px;
  }
  .doc-dialog-body {
    padding: 18px 18px 22px;
  }
  .doc-dialog-foot {
    padding: 14px 18px max(18px, env(safe-area-inset-bottom));
  }
  .doc-dialog-foot > button {
    flex: 1 1 auto;
    min-height: 48px;
    white-space: normal;
    text-align: center;
  }
  .doc-dialog-foot .doc-recipient {
    flex: 1 1 100%;
  }
  :is(.documents-page, .doc-dialog)
    :where(
      input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
      select,
      textarea
    ) {
    font-size: 16px;
  }
  .doc-choice {
    width: 100%;
  }
  .doc-choice label {
    flex: 1 1 0;
  }
  .doc-choice span {
    justify-content: center;
    width: 100%;
  }
}
@media (max-width: 360px) {
  .doc-segments {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 24px;
  }
  .doc-segments > button:last-of-type:nth-of-type(odd) {
    grid-column: 1 / -1;
  }
}
@media (prefers-reduced-motion: reduce) {
  :is(.documents-page, .doc-dialog) *,
  :is(.documents-page, .doc-dialog) *::before,
  :is(.documents-page, .doc-dialog) *::after {
    transition: none !important;
    animation: none !important;
  }
  /* Own rule: browsers without ::details-content would drop a whole list containing it */
  .documents-page details::details-content {
    transition: none !important;
  }
}
