.finance-documents {
  --fd-line: var(--border, #22504f);
  --fd-surface: var(--card, #163b3f);
  --fd-raised: var(--card-2, #1b4549);
  --fd-text: var(--text, #e8f2f1);
  --fd-muted: var(--text-muted, #87a09e);
  --fd-accent: var(--primary, #7fd3d1);
  color: var(--fd-text);
  min-width: 0;
  padding: 2px 0 12px;
}

.fd-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 2px 0 20px;
}

.fd-heading-copy { min-width: 0; }
.fd-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--fd-accent);
  font: 700 10px/1.3 "IBM Plex Mono", monospace;
  letter-spacing: .12em;
}
.fd-heading h2 {
  margin: 0;
  color: var(--fd-text);
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -.025em;
  line-height: 1.3;
}
.fd-heading p {
  margin: 6px 0 0;
  color: var(--fd-muted);
  font-size: 13px;
  line-height: 1.65;
}
.fd-heading-actions, .fd-form-actions, .fd-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.fd-button {
  display: inline-flex;
  min-height: 37px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--fd-line);
  border-radius: 9px;
  background: transparent;
  color: var(--fd-text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, opacity .14s ease;
}
.fd-button:hover:not(:disabled) { border-color: var(--fd-accent); }
.fd-button:disabled, .fd-delete-button:disabled { cursor: wait; opacity: .58; }
.fd-button-primary {
  border-color: var(--fd-accent);
  background: var(--fd-accent);
  color: var(--on-primary, #0a2528);
}
.fd-button-primary:hover:not(:disabled) { background: var(--primary-light, #a9e2e0); }
.fd-button-quiet { color: var(--text-2, #b8cdcb); }
.fd-button-quiet:hover:not(:disabled) { background: var(--fd-raised); }
.finance-documents button:focus-visible,
.finance-documents a:focus-visible,
.finance-documents input:focus-visible {
  outline: 2px solid var(--fd-accent);
  outline-offset: 2px;
}

.fd-card {
  overflow: hidden;
  border: 1px solid var(--fd-line);
  border-radius: var(--radius, 14px);
  background: var(--fd-surface);
  box-shadow: var(--shadow-sm, 0 1px 0 rgba(0,0,0,.25), 0 2px 6px rgba(0,0,0,.18));
}
.fd-form { padding: 18px 20px 16px; margin: 0 0 17px; }
.fd-form-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 15px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--fd-line);
}
.fd-form-mark, .fd-row-icon, .fd-empty-symbol {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--fd-accent);
  background: color-mix(in srgb, var(--fd-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--fd-accent) 24%, var(--fd-line));
}
.fd-form-mark { width: 34px; height: 34px; border-radius: 9px; }
.fd-form-heading h3 { margin: 0; font-size: 14px; line-height: 1.4; }
.fd-form-heading p { margin: 3px 0 0; color: var(--fd-muted); font-size: 11.5px; }
.fd-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(150px, .8fr) minmax(145px, .7fr);
  gap: 14px 15px;
}
.fd-field { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.fd-field-title { grid-column: span 1; }
.fd-field-file { grid-column: 1 / -1; }
.fd-field label { color: var(--text-2, #b8cdcb); font-size: 11.5px; font-weight: 650; }
.fd-field label span { color: var(--fd-accent); }
.fd-field input:not([type="file"]) {
  width: 100%;
  min-height: 39px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong, #335e5d);
  border-radius: 8px;
  background: var(--bg-2, #123335);
  color: var(--fd-text);
  font: inherit;
  font-size: 12.5px;
  color-scheme: dark;
}
html[data-theme="light"] .fd-field input:not([type="file"]) { color-scheme: light; }
.fd-field input::placeholder { color: var(--fd-muted); opacity: .85; }
.fd-field input:disabled { opacity: .65; }
.fd-file-picker {
  position: relative;
  display: flex;
  min-height: 41px;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 4px 5px 4px 11px;
  border: 1px solid var(--border-strong, #335e5d);
  border-radius: 8px;
  background: var(--bg-2, #123335);
}
.fd-file-picker:focus-within {
  outline: 2px solid var(--fd-accent);
  outline-offset: 2px;
}
.fd-file-picker input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.fd-file-picker input[type="file"]:disabled { cursor: wait; }
.fd-file-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--fd-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fd-file-trigger {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--fd-line);
  border-radius: 6px;
  background: var(--fd-raised);
  color: var(--fd-text);
  font-size: 11px;
  font-weight: 650;
}
.fd-field small { color: var(--fd-muted); font-size: 10.5px; line-height: 1.5; }
.fd-form-actions { justify-content: flex-end; padding-top: 15px; margin-top: 14px; border-top: 1px solid var(--fd-line); }

.fd-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin: 12px 0 0;
  border: 1px solid color-mix(in srgb, var(--rag-red, #d85949) 40%, var(--fd-line));
  border-radius: 8px;
  background: var(--rag-red-bg, #3f1f1b);
  color: var(--text, #e8f2f1);
  font-size: 12px;
  line-height: 1.55;
}
.fd-load-alert { margin: 0 0 13px; }
.fd-text-button {
  flex: 0 0 auto;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--fd-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fd-list { padding: 0 17px; }
.fd-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border-bottom: 1px solid var(--fd-line);
  color: var(--text-2, #b8cdcb);
  font-size: 11px;
  font-weight: 700;
}
.fd-count {
  padding: 3px 8px;
  border: 1px solid var(--fd-line);
  border-radius: 999px;
  color: var(--fd-muted);
  font: 600 10px/1.3 "IBM Plex Mono", monospace;
}
.fd-row {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 15px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--fd-line) 72%, transparent);
}
.fd-row:last-child { border-bottom: 0; }
.fd-row-icon { width: 36px; height: 40px; border-radius: 8px; }
.fd-row-main { min-width: 0; flex: 1; }
.fd-row-title {
  overflow: hidden;
  margin: 0;
  color: var(--fd-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  text-overflow: ellipsis;
}
.fd-row-sub, .fd-row-file, .fd-row-byline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 4px;
  color: var(--fd-muted);
  font-size: 10.5px;
  line-height: 1.5;
}
.fd-row-sub { margin-top: 3px; }
.fd-period { color: var(--text-2, #b8cdcb); font-weight: 600; }
.fd-row-date { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.fd-row-file { color: var(--text-2, #b8cdcb); }
.fd-row-file > span:first-child { max-width: min(480px, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-file-size { color: var(--fd-muted); font: 10px "IBM Plex Mono", monospace; white-space: nowrap; }
.fd-row-byline { font-size: 10px; }
.fd-row-actions { gap: 7px; }
.fd-open-link, .fd-delete-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--fd-line);
  border-radius: 7px;
  color: var(--fd-accent);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}
.fd-open-link:hover { border-color: var(--fd-accent); background: color-mix(in srgb, var(--fd-accent) 9%, transparent); }
.fd-delete-button { background: transparent; color: var(--fd-muted); cursor: pointer; }
.fd-delete-button:hover:not(:disabled) { border-color: var(--rag-red, #d85949); color: var(--rag-red, #d85949); }

.fd-empty {
  display: flex;
  min-height: 196px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  text-align: center;
}
.fd-empty-symbol { width: 42px; height: 42px; margin-bottom: 12px; border-radius: 12px; }
.fd-empty h3 { margin: 0; font-size: 14px; font-weight: 700; }
.fd-empty p { max-width: 380px; margin: 5px 0 0; color: var(--fd-muted); font-size: 12px; line-height: 1.6; }

.fd-skeleton-row {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 77px;
  border-bottom: 1px solid color-mix(in srgb, var(--fd-line) 72%, transparent);
}
.fd-skeleton-row:last-child { border-bottom: 0; }
.fd-skeleton-icon, .fd-skeleton-copy i, .fd-skeleton-meta {
  display: block;
  border-radius: 6px;
  background: color-mix(in srgb, var(--fd-raised) 82%, var(--fd-line));
  animation: fd-pulse 1.5s ease-in-out infinite alternate;
}
.fd-skeleton-icon { width: 36px; height: 40px; }
.fd-skeleton-copy { display: grid; flex: 1; gap: 8px; }
.fd-skeleton-copy i { width: 42%; height: 9px; }
.fd-skeleton-copy i + i { width: 27%; height: 7px; }
.fd-skeleton-meta { width: 80px; height: 26px; }
@keyframes fd-pulse { from { opacity: .48; } to { opacity: .92; } }

@media (max-width: 720px) {
  .fd-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
  .fd-heading-actions { width: 100%; }
  .fd-heading-actions .fd-button { flex: 1; }
  .fd-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fd-field-title, .fd-field-file { grid-column: 1 / -1; }
  .fd-row { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .fd-row-icon { width: 34px; height: 37px; }
  .fd-row-main { flex-basis: calc(100% - 48px); }
  .fd-row-actions { width: 100%; padding-inline-start: 44px; }
}
@media (max-width: 460px) {
  .fd-heading h2 { font-size: 19px; }
  .fd-form { padding: 15px 13px 13px; }
  .fd-fields { grid-template-columns: minmax(0, 1fr); }
  .fd-field-title, .fd-field-file { grid-column: auto; }
  .fd-list { padding-inline: 12px; }
  .fd-row-actions { padding-inline-start: 0; }
  .fd-row-actions > * { flex: 1; }
  .fd-open-link, .fd-delete-button { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .fd-skeleton-icon, .fd-skeleton-copy i, .fd-skeleton-meta { animation: none; }
  .fd-button, .fd-open-link, .fd-delete-button { transition: none; }
}
