.documents-page > .container { max-width: 1440px; }
.documents-page h2 { color: #334155; font-size: clamp(1.2rem, 2vw, 1.5rem); }
.documents-page .store-filter-controls { padding: 1rem; border: 1px solid #e2e8e0; border-radius: 12px; background: #f6f7f5; }
.documents-page .store-filter-controls .input-group { flex: 1 1 0; min-width: 0; }
.documents-page :is(.form-select, .dt-input, .document-actions .btn, #applyFilterBtn) { min-height: 44px; }
.documents-page :is(button, select, input):focus-visible { outline: 3px solid var(--primary-dark, #355505); outline-offset: 3px; }
.documents-page .btn-group { padding: .25rem; gap: .25rem; border: 1px solid #d8e2d2; border-radius: 12px; background: #f4f7f1; }
.documents-page .btn-group > .btn { margin: 0; border: 0; border-radius: 8px !important; }
.documents-page .btn-group > .btn.active { color: #fff; background: var(--primary-action, #4d7507); }
.documents-page .documents-table-shell { min-height: 250px; border: 0; border-radius: 0; }
.documents-page .dt-layout-table { overflow: visible; }
#documentsTable { table-layout: fixed; }
#documentsTable th, #documentsTable td { overflow-wrap: anywhere; }
#documentsTable th:nth-child(1) { width: 25%; }
#documentsTable th:nth-child(2) { width: 14%; }
#documentsTable th:nth-child(3) { width: 15%; }
#documentsTable th:last-child { width: 24%; }
.document-kind { display: block; margin-bottom: .15rem; color: var(--theme-muted, #64748b); font-size: .75rem; font-weight: 500; }
.document-number { color: var(--theme-text, #294321); font-weight: 700; }
.document-total { color: var(--theme-text, #294321); font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.document-state { display: inline-block; max-width: 100%; padding: .3rem .6rem; border: 1px solid var(--theme-border, #dde5d7); border-radius: 8px; color: var(--theme-muted, #43573e); background: var(--theme-soft, #f1f5ee); font-size: .8rem; font-weight: 600; }
.document-payment { display: block; margin-top: .3rem; color: var(--theme-muted, #64748b); font-size: .8rem; }
.document-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.document-actions .btn { display: inline-flex; justify-content: center; align-items: center; gap: .4rem; padding: .5rem .65rem; border-radius: 8px; font-size: .875rem; }
.documents-mobile-sort { display: none; }
.documents-initial-state { margin-bottom: 1rem; padding: clamp(2rem, 5vw, 4rem) 1.25rem; border: 2px dashed #d8e2d2; border-radius: 16px; background: #f6f8f3; text-align: center; }
.documents-initial-icon { display: inline-flex; align-items: center; justify-content: center; width: 76px; height: 76px; margin-bottom: 1.25rem; border-radius: 50%; color: var(--primary-dark, #355505); background: #e7eedf; font-size: 2rem; }
.documents-initial-state h3 { margin-bottom: .75rem; color: #294321; font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: 700; }
.documents-initial-state p { max-width: 540px; margin: 0 auto; color: #43573e; }
.documents-initial-state .documents-initial-detail { margin-top: .75rem; color: var(--theme-muted, #64748b); font-size: .9rem; }
.document-action-dialog { width: min(480px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); margin: auto; padding: 2rem; overflow-y: auto; border: 1px solid #e0e7da; border-radius: 24px; color: #334155; background: var(--theme-surface, #fff); box-shadow: 0 24px 80px #172a1b33; }
.document-action-dialog::backdrop { background: #14261880; backdrop-filter: blur(3px); }
.document-action-dialog h2, .document-action-dialog h3 { color: #294321; font-size: 1.35rem; font-weight: 700; }
.document-recovery-dialog { text-align: center; }
.document-recovery-dialog h2:focus { outline: none; }
.document-recovery-dialog p { margin: .75rem 0 1.5rem; color: var(--theme-muted, #64748b); }
.document-recovery-art, .document-mail-art { position: relative; width: 220px; max-width: 100%; height: 130px; margin: 0 auto 1.25rem; border-radius: 50%; background: radial-gradient(ellipse, #edf5e5 0%, #fff 72%); }
.recovery-archive { position: absolute; left: 18px; top: 34px; width: 60px; height: 70px; border: 2px solid #90a67c; border-radius: 10px; background: #dfead5; }
.recovery-archive::before, .recovery-archive::after { content: ''; position: absolute; left: 10px; right: 10px; height: 20px; border: 1px solid #a8ba99; border-radius: 4px; background: #f5f8f0; }
.recovery-archive::before { top: 10px; }
.recovery-archive::after { bottom: 10px; }
.recovery-sheet { position: absolute; top: 24px; left: 91px; width: 46px; height: 62px; border: 2px solid #7b995e; border-radius: 5px; background: repeating-linear-gradient(#fff 0 11px, #dce8d0 11px 13px, #fff 13px 18px); box-shadow: 0 5px 12px #35550514; }
.recovery-sheet-back { transform: rotate(-12deg); }
.recovery-sheet-front { transform: rotate(7deg); }
.document-recovery-dialog[open] .recovery-sheet { animation: recover-document 1.8s ease-in-out infinite; }
.document-recovery-dialog[open] .recovery-sheet-front { animation-delay: .3s; }
.recovery-tray { position: absolute; right: 14px; bottom: 22px; width: 65px; height: 22px; border: 2px solid #6f8c51; border-top: 0; border-radius: 0 0 10px 10px; background: #dceacb; }
.document-recovery-progress { height: 5px; overflow: hidden; border-radius: 9px; background: #edf2e8; }
.document-recovery-progress span { display: block; width: 35%; height: 100%; border-radius: inherit; background: var(--primary-action, #4d7507); }
.document-recovery-dialog[open] .document-recovery-progress span { animation: recover-progress 1.5s ease-in-out infinite alternate; }
.document-email-dialog { position: fixed; }
.document-email-dialog form { margin: 0; }
.document-dialog-close { position: absolute; top: 1rem; right: 1rem; min-width: 44px; min-height: 44px; }
.document-email-dialog .form-control { min-height: 48px; }
.document-email-dialog .document-email-summary { padding: .9rem; border-radius: 12px; background: #f3f7ee; font-size: .9rem; overflow-wrap: anywhere; }
.document-email-dialog .btn { min-height: 44px; }
.mailbox { position: absolute; right: 10px; top: 28px; width: 70px; height: 58px; border: 3px solid #527433; border-radius: 32px 32px 7px 7px; background: #a6c58a; }
.mailbox::before { content: ''; position: absolute; left: 10px; top: 19px; width: 37px; height: 6px; border-radius: 5px; background: #355505; }
.mailbox::after { content: ''; position: absolute; top: 55px; left: 27px; width: 10px; height: 33px; border-radius: 0 0 4px 4px; background: #7d946a; }
.mailbox-flag { position: absolute; right: -8px; top: 3px; width: 20px; height: 12px; border-left: 4px solid #527433; background: #e9ab55; transform-origin: left bottom; }
.mail-trail { position: absolute; left: 28px; right: 45px; top: 71px; border-top: 2px dashed #bfd1ac; }
.mail-envelope { position: absolute; left: 17px; top: 48px; width: 58px; height: 39px; border: 2px solid #70944e; border-radius: 5px; background: var(--theme-surface, #fff); box-shadow: 0 6px 12px #35550514; z-index: 1; }
.mail-envelope::before { content: ''; position: absolute; top: -1px; left: 7px; width: 38px; height: 28px; border-right: 2px solid #70944e; border-bottom: 2px solid #70944e; transform: rotate(45deg) skew(-10deg, -10deg) translate(-6px, -12px); }
.document-email-dialog.is-sending .mail-envelope { animation: send-envelope 1.8s ease-in-out infinite; }
@keyframes recover-document { 0% { opacity: 0; transform: translate(-42px, 22px) rotate(-12deg); } 25%, 50% { opacity: 1; transform: translate(0, -8px) rotate(4deg); } 85%, 100% { opacity: 0; transform: translate(65px, 30px) rotate(0); } }
@keyframes recover-progress { from { transform: translateX(-100%); } to { transform: translateX(285%); } }
@keyframes send-envelope { 0%, 15% { opacity: 1; transform: translate(0, 0) rotate(-8deg); } 65% { opacity: 1; transform: translate(95px, -18px) rotate(5deg); } 85%, 100% { opacity: 0; transform: translate(126px, -9px) scale(.3); } }
@media (prefers-reduced-motion: reduce) {
    .document-action-dialog *, .document-action-dialog[open] .recovery-sheet, .document-recovery-dialog[open] .document-recovery-progress span { animation: none !important; transition: none !important; }
}
@media (max-width: 575.98px) {
    .document-action-dialog { padding: 1.5rem 1.1rem; }
    .document-email-dialog form > .d-flex .btn { flex: 1; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .documents-panel > .card-body { padding: 1rem; }
    .documents-page .dt-container table.dataTable :is(th, td) { padding: .7rem .45rem; }
    .document-actions { flex-direction: column; }
    .document-actions .btn { width: 100%; }
    #documentsTable th:last-child { width: 19%; }
}

@media (max-width: 767.98px) {
    .documents-panel { border: 0; background: transparent; overflow: visible; }
    .documents-panel > .card-body { padding: 0; }
    .documents-page .btn-group { display: flex; }
    .documents-page .btn-group > .btn { flex: 1; }
    .documents-page .store-filter-controls { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .75rem; }
    .documents-page #applyFilterBtn { grid-column: 1 / -1; justify-content: center; }
    .documents-mobile-sort { display: flex; align-items: center; gap: .5rem; }
    .documents-mobile-sort label { flex-shrink: 0; color: var(--theme-muted, #64748b); font-size: .875rem; }
    .documents-mobile-sort select { min-width: 0; font-size: .875rem; }
    .documents-page .dt-layout-table { border: 0; background: transparent; }
    .documents-page .dt-search { width: 100%; }
    .documents-page .dt-search input { min-width: 0; width: 100%; }
    .documents-page .dt-length select { min-height: 44px; }
    .documents-page .document-card-icon { float: left; width: 42px; height: 42px; margin-right: .75rem; padding: .7rem; border-radius: 10px; color: var(--theme-accent, #4d7507); background: var(--primary-soft, #e7eedf); font-size: 1.25rem; text-align: center; }
    .documents-page .document-total { font-size: 1.2rem; }
    #documentsTable, #documentsTable tbody { display: block; }
    #documentsTable thead, #documentsTable colgroup { display: none; }
    #documentsTable tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: 'identity identity' 'date total' 'state state' 'actions actions'; gap: .75rem; margin-bottom: 1rem; padding: 1rem; border: 1px solid #dce3d7; border-radius: 12px; background: var(--theme-surface, #fff); }
    #documentsTable tbody tr:not(:has(.document-status-cell)) { grid-template-areas: 'identity identity' 'date total' 'actions actions'; }
    .documents-page #documentsTable tbody td { display: block; min-width: 0; padding: 0; border: 0; background: transparent; box-shadow: none; text-align: left !important; }
    #documentsTable td[data-label]::before { content: attr(data-label); display: block; margin-bottom: .25rem; color: var(--theme-muted, #64748b); font-size: .75rem; font-weight: 600; }
    #documentsTable .document-identity { grid-area: identity; }
    #documentsTable .document-date-cell { grid-area: date; }
    #documentsTable .document-total-cell { grid-area: total; }
    #documentsTable .document-status-cell { grid-area: state; }
    #documentsTable .document-actions-cell { grid-area: actions; padding-top: .75rem; border-top: 1px solid #e9ecef; }
    #documentsTable td.document-identity::before, #documentsTable td.document-actions-cell::before { display: none; }
    .document-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .document-actions .btn { width: 100%; }
    #documentsTable .dt-empty { grid-column: 1 / -1; text-align: center !important; padding: 1rem !important; }
}
