/* Documents: the add-a-file screen (drop area, file card, upload steps) and small entry cues. Colours come from tokens only. */
.doc-form { gap: var(--space-4); }
.doc-fields { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--space-4); }
.doc-fields:disabled { opacity: 0.65; }

/* The drop area: the real file input sits invisibly on top, so a tap, a keyboard press or a drop all work natively. */
.drop { position: relative; display: grid; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-card); background: var(--surface); transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.drop-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; font-size: 0; }
@media (hover: hover) { .drop:hover { border-color: var(--accent); } }
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.drop[data-invalid="true"] { border-color: var(--negative); }
.drop-empty { display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-6) var(--space-4); text-align: center; }
.drop-empty[hidden], .drop-file[hidden] { display: none; }
.drop-icon { width: 52px; height: 52px; margin-bottom: var(--space-2); display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.drop-title { font: 600 var(--fs-body)/1.3 var(--font-sans); color: var(--text); }
.drop-sub { font-size: var(--fs-small); color: var(--text-muted); }
.drop.has-file { border-style: solid; border-color: var(--border-strong); }
.drop.has-file .drop-input { pointer-events: none; }
.drop-file { display: flex; align-items: center; gap: var(--space-3); min-width: 0; padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); }
.drop-badge { flex: none; min-width: 3rem; height: 3rem; padding: 0 var(--space-2); display: grid; place-items: center; border-radius: var(--radius-input); background: var(--accent-soft); color: var(--accent); font: 600 var(--fs-caption)/1 var(--font-sans); }
.drop-meta { flex: 1; min-width: 0; }
.drop-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-size { font-size: var(--fs-small); color: var(--text-muted); }
.drop-remove { position: relative; z-index: 1; flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; }
@media (hover: hover) { .drop-remove:hover { background: var(--surface-2); color: var(--text); } }

/* Upload steps: a four-part bar and a short list, ticked off as each step finishes. */
.doc-progress { display: grid; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.doc-progress[hidden] { display: none; }
.doc-bar { margin-top: 0; }
.doc-bar span.busy { animation: doc-bar 1.1s ease-in-out infinite; }
.doc-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.doc-stages li { display: flex; align-items: center; gap: var(--space-3); font-size: var(--fs-small); color: var(--text-muted); }
.doc-dot { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border: 1.5px solid var(--border-strong); border-radius: 50%; color: transparent; transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out); }
.doc-stages li.is-active { color: var(--text); font-weight: 600; }
.doc-stages li.is-active .doc-dot { border-color: var(--accent); animation: doc-ring 1.3s ease-out infinite; }
.doc-stages li.is-done { color: var(--text); }
.doc-stages li.is-done .doc-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.doc-stages li.is-failed { color: var(--negative); font-weight: 600; }
.doc-stages li.is-failed .doc-dot { border-color: var(--negative); }
@keyframes doc-bar { 50% { opacity: 0.45; } }
@keyframes doc-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .doc-bar span.busy, .doc-stages li.is-active .doc-dot { animation: none; } }

/* Buttons: the main one keeps its label on one line (slightly smaller text); Cancel stays compact beside it.
   If the text size is turned right up, the row simply stacks instead of squeezing. */
.doc-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.doc-actions .btn { white-space: nowrap; padding: 0 var(--space-4); font-size: calc(var(--fs-small) * 0.94); }
.doc-actions .btn:first-child { flex: 1 1 11rem; }
.doc-actions .btn--secondary { flex: 0 0 auto; min-width: 6.5rem; }
.doc-actions [aria-disabled="true"] { pointer-events: none; opacity: 0.5; }

/* Small cues: a paperclip on ledger rows that have a document. */
.doc-clip { display: inline-flex; vertical-align: -2px; margin-left: var(--space-2); color: var(--text-muted); }

/* Preview (photos and text shown inside the page). */
.doc-preview { display: grid; gap: var(--space-2); }
.doc-preview[hidden] { display: none; }
.doc-preview-img { display: block; max-width: 100%; height: auto; max-height: 70vh; margin: 0 auto; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.doc-preview-text { margin: 0; padding: var(--space-4); max-height: 24rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: var(--fs-small)/1.5 var(--font-mono); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.doc-preview-text:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
