html:has(.fi-drawer[open]) { overflow: hidden; }
.fi-drawer {
  --fi-ink: var(--ink,#172d24); --fi-muted: var(--muted,#5c6d63);
  --fi-accent: var(--green,#18583d); --fi-border: var(--line,#dce3da);
  position: fixed; inset: 0 0 0 auto; box-sizing: border-box;
  width: min(100%, 670px); height: 100%; height: 100dvh; max-width: 100%; max-height: 100dvh;
  margin: 0 0 0 auto; padding: 0; border: 0; background: #fff; color: var(--fi-ink);
  text-align: left; font: inherit; overflow: hidden; box-shadow: -10px 0 45px #0d2a1d22;
}
.fi-drawer[open] { display: flex; flex-direction: column; animation: fi-appear .17s ease-out; }
.fi-drawer::backdrop { background: rgb(10 29 20 / 47%); }
@keyframes fi-appear { from { transform: translateX(24px); opacity: .75; } to { transform: none; opacity: 1; } }
.fi-drawer *, .fi-drawer *::before, .fi-drawer *::after { box-sizing: border-box; }
.fi-drawer [hidden] { display: none !important; }
.fi-drawer :is(h2,h3,p,dl,dd) { margin: 0; }
.fi-drawer button, .fi-drawer input, .fi-drawer textarea, .fi-drawer select { font: inherit; }
.fi-drawer button, .fi-drawer select, .fi-file, .fi-download { cursor: pointer; }
.fi-drawer button { appearance: none; }
.fi-drawer :is(button,input,textarea,select,a):focus-visible { outline: 3px solid #668c46; outline-offset: 3px; }
.fi-drawer :disabled { cursor: wait; opacity: .65; }
.fi-top, .fi-foot { display: flex; align-items: center; gap: 14px; flex: none; padding: 21px 32px; background: #fff; }
.fi-top { border-bottom: 1px solid var(--fi-border); justify-content: space-between; }
.fi-top h2 { font-size: clamp(1.35rem,3vw,1.6rem); line-height: 1.15; letter-spacing: -.045em; font-weight: 660; }
.fi-close { border: 1px solid var(--fi-border); background: white; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--fi-muted); padding: 0; flex: none; }
.fi-close:hover, .fi-secondary:hover, .fi-download:hover { background: #f2f6f0; }
.fi-body { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; padding: 4px 32px 30px; overscroll-behavior: contain; }
.fi-foot { justify-content: flex-end; border-top: 1px solid var(--fi-border); padding-top: 15px; padding-bottom: max(15px,env(safe-area-inset-bottom)); }
.fi-section { padding: 23px 0; border-bottom: 1px solid var(--fi-border); }
.fi-section:last-child { border: 0; }
.fi-section h3 { display: flex; align-items: center; gap: 8px; font-size: 1rem; letter-spacing: -.02em; font-weight: 700; line-height: 1.3; margin: 0 0 14px; }
.fi-section h3 svg { color: var(--fi-accent); }
.fi-drawer svg { display: inline-block; vertical-align: middle; flex: none; }
.fi-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px 14px; align-items: start; }
.fi-wide { grid-column: 1 / -1; }
.fi-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fi-label { color: var(--fi-ink); font-size: .89rem; line-height: 1.4; font-weight: 600; }
.fi-drawer :is(input:not([type=file]):not([type=checkbox]),select,textarea) {
  width: 100%; min-width: 0; max-width: 100%; height: 42px; padding: 9px 12px; color: var(--fi-ink);
  background: #fff; border: 1px solid #bdcbbf; border-radius: 7px; font-size: .95rem;
}
.fi-drawer textarea { height: auto; min-height: 68px; resize: vertical; line-height: 1.45; }
.fi-drawer select { appearance: none; padding-right: 33px; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24' stroke='%23536559' stroke-width='1.8'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center; }
.fi-drawer input::placeholder, .fi-drawer textarea::placeholder { color: #758279; opacity: 1; }
.fi-hint, .fi-muted, .fi-meta { color: var(--fi-muted); line-height: 1.48; font-size: .875rem; }
.fi-field .fi-hint { margin-top: 0; }
.fi-primary, .fi-secondary, .fi-download { display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-radius: 7px; min-height: 40px; line-height: 1.3; text-align: center; font-weight: 650!important; font-size: .9rem!important; text-decoration: none; }
.fi-primary { background: var(--fi-accent); color: #fff; }
.fi-primary:hover { background: #114a31; }
.fi-secondary,.fi-download { border-color: var(--fi-border); background: #fff; color: var(--fi-ink); }
.fi-method { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--fi-border); background: #f3f6f0; border-radius: 8px; }
.fi-method button { flex: 1; border-radius: 5px; border: 1px solid transparent; padding: 8px; background: transparent; color: var(--fi-muted); font-size: .9rem; font-weight: 600; }
.fi-method button[aria-pressed=true] { border-color: #c2d2c3; background: #fff; color: var(--fi-accent); box-shadow: 0 1px 3px #17301812; }
.fi-file { position: relative; display: flex; align-items: center; gap: 11px; padding: 11px 13px; min-height: 61px; border: 1px dashed #a9b9a9; border-radius: 8px; background: #f9fbf7; min-width: 0; }
.fi-file:hover, .fi-file:focus-within { background: #eff6e9; border-color: var(--fi-accent); }
.fi-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fi-file svg { color: var(--fi-accent); }
.fi-file-copy { display: grid; gap: 1px; overflow: hidden; }
.fi-file-copy strong, .fi-filename { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size: .91rem; font-weight: 600; line-height: 1.4; }
.fi-file-copy small { font-size: .8rem; color: var(--fi-muted); line-height: 1.4; }
.fi-note { margin: 10px 0 0!important; border-radius: 7px; background: #f0f6eb; color: #36503b; padding: 10px 12px; font-size: .89rem; line-height: 1.5; overflow-wrap: anywhere; }
.fi-note.fi-warn { background: #fbf3df; color: #71521a; }
.fi-note.fi-fail { background: #fcf0eb; color: #8c3529; }
.fi-error { margin: 15px 0!important; }
.fi-hero { margin-top: 23px; padding: 20px; border-radius: 10px; background: #eff4eb; display: grid; gap: 5px; }
.fi-hero .fi-large { font-size: clamp(1.65rem,5vw,2.2rem); letter-spacing: -.055em; font-weight: 660; line-height: 1.15; }
.fi-hero-top, .fi-doc-row, .fi-person, .fi-key-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fi-hero-top { flex-wrap: wrap; }
.fi-status { white-space: nowrap; color: #475b47; background: #dce7d7; border-radius: 20px; padding: 3px 9px; font-size: .79rem; font-weight: 620; }
.fi-status.review, .fi-status.overdue { color: #7d501e; background: #f5e6bd; }
.fi-data { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.fi-data div { min-width: 0; }
.fi-data dt { color: var(--fi-muted); font-size: .84rem; margin-bottom: 2px; }
.fi-data dd { font-size: .96rem; overflow-wrap: anywhere; white-space: pre-line; }
.fi-key { margin-top: 15px; border: 1px solid var(--fi-border); border-radius: 8px; padding: 12px; display: grid; gap: 7px; background: #fbfcfa; }
.fi-key code { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fi-ink); font-family: ui-monospace,monospace; line-height: 1.55; font-size: .91rem; }
.fi-key .fi-secondary, .fi-doc-row .fi-download { padding: 4px 8px; min-height: 29px; font-size: .83rem!important; }
.fi-doc-row, .fi-person { padding: 12px 0; border-bottom: 1px solid var(--fi-border); }
.fi-doc-row:last-child, .fi-person:last-child { border: none; }
.fi-doc-data { min-width: 0; flex: 1; }
.fi-doc-data strong,.fi-person strong { font-size: .93rem; display: block; overflow-wrap: anywhere; }
.fi-doc-data .fi-meta, .fi-person .fi-meta { overflow-wrap: anywhere; }
.fi-person { flex-wrap: wrap; }
.fi-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 12px; }
.fi-checks { padding: 0; margin: 8px 0; list-style: none; }
.fi-checks li { display: flex; gap: 8px; padding: 4px 0; font-size: .87rem; line-height: 1.45; }
.fi-checks li svg { margin-top: 2px; }
.fi-history { list-style: none; padding: 0; margin: 0; }
.fi-history li { border-left: 2px solid #d6e0d0; padding: 0 0 12px 13px; font-size: .92rem; }
.fi-history li:last-child { padding-bottom: 0; }
.fi-drawer details { margin-top: 9px; font-size: .87rem; }
.fi-drawer summary { cursor: pointer; font-weight: 580; }
.fi-review { padding: 15px; margin-top: 14px; border: 1px solid #dccf9e; border-radius: 8px; background: #fdfbf4; }
@media (max-width: 550px) {
  .fi-top, .fi-foot { padding-left: 18px; padding-right: 18px; }
  .fi-body { padding-left: 18px; padding-right: 18px; }
  .fi-grid { column-gap: 10px; }
  .fi-section { padding: 19px 0; }
  .fi-top { padding-top: 16px; padding-bottom: 16px; }
  .fi-person .fi-secondary { min-height: 36px; }
  .fi-drawer :is(input:not([type=file]),select,textarea) { font-size: 1rem; }
}
@media (max-width: 380px) { .fi-grid, .fi-data { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .fi-drawer[open] { animation: none; } }
.fi-add-doc { padding: 10px 12px; border-radius: 7px; border: 1px solid var(--fi-border); }
.fi-add-doc form { margin-top: 12px; }
.fi-person .fi-actions { margin: 0; gap: 6px; }
