.batch-c-documents-view,
.batch-c-documents-container {
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}

.batch-c-document-header > div:first-child {
    align-items: center !important;
}

.batch-c-scope-toggle {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    color: #334155;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
}

.batch-c-scope-toggle input,
.batch-c-row-select,
.batch-c-document-types input {
    width: 18px;
    height: 18px;
    accent-color: #1d4ed8;
}

.batch-c-document-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(105px, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.batch-c-summary-item {
    min-width: 0;
    padding: 10px;
    border: 1px solid #dbe3ec;
    border-left: 3px solid #64748b;
    border-radius: 6px;
    background: #f8fafc;
}

.batch-c-summary-item span {
    display: block;
    min-height: 32px;
    color: #475569;
    font-size: 0.73rem;
    font-weight: 700;
}

.batch-c-summary-item strong {
    display: block;
    margin-top: 3px;
    color: #0f172a;
    font-size: 1.3rem;
}

.batch-c-summary-item.is-danger { border-left-color: #dc2626; }
.batch-c-summary-item.is-warning { border-left-color: #d97706; }
.batch-c-summary-item.is-info { border-left-color: #0284c7; }
.batch-c-summary-item.is-success { border-left-color: #15803d; }

.batch-c-document-filters {
    align-items: flex-start !important;
}

.batch-c-stage-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.batch-c-stage-filters .tab-btn {
    min-height: 36px;
}

.batch-c-document-layout {
    grid-template-columns: minmax(600px, 1.35fr) minmax(300px, .65fr) !important;
    min-width: 0;
}

.batch-c-table-section,
.batch-c-table-scroller {
    min-width: 0;
}

.batch-c-table-scroller {
    overflow-x: visible !important;
}

.batch-c-document-table {
    min-width: 0 !important;
    table-layout: fixed;
}

.batch-c-document-table th,
.batch-c-document-table td {
    padding: 10px !important;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.batch-c-document-table th:first-child,
.batch-c-document-table td:first-child { width: 42px; }
.batch-c-document-table th:nth-child(2) { width: 18%; }
.batch-c-document-table th:nth-child(3) { width: 23%; }
.batch-c-document-table th:nth-child(4) { width: 18%; }
.batch-c-document-table th:nth-child(5) { width: 96px; }
.batch-c-document-table th:last-child { width: 132px; }

.batch-c-document-row {
    border-top: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
}

.batch-c-document-row:hover {
    background: #f8fafc;
}

.batch-c-document-row td:nth-child(2) strong,
.batch-c-document-row td:nth-child(2) small {
    display: block;
}

.batch-c-document-row td:nth-child(2) small {
    margin-top: 3px;
    color: #64748b;
}

.batch-c-status,
.batch-c-expiry {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    max-width: 100%;
    padding: 4px 7px;
    border-radius: 5px;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1.35;
}

.batch-c-status.is-danger,
.batch-c-expiry.is-danger { background: #fee2e2; color: #991b1b; }
.batch-c-status.is-warning,
.batch-c-expiry.is-warning { background: #fef3c7; color: #92400e; }
.batch-c-status.is-info { background: #e0f2fe; color: #075985; }
.batch-c-status.is-success { background: #dcfce7; color: #166534; }

.batch-c-next-owner {
    display: block;
    margin-top: 5px;
    color: #475569;
    font-size: 0.75rem;
    line-height: 1.4;
}

.batch-c-expiry {
    margin-top: 5px;
}

.batch-c-open-documents {
    width: 100%;
    min-height: 36px;
    padding: 6px 8px !important;
    white-space: normal;
    line-height: 1.25;
}

.batch-c-document-card-list {
    display: none;
}

.batch-c-detail {
    display: grid;
    gap: 14px;
}

.batch-c-detail-person > span {
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 700;
}

.batch-c-detail-person h3 {
    margin: 3px 0;
    font-size: 1.05rem;
}

.batch-c-detail-person p,
.batch-c-detail section p {
    margin: 0;
    color: #475569;
    font-size: 0.83rem;
}

.batch-c-detail-stage,
.batch-c-detail section {
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.batch-c-detail h4 {
    margin: 0 0 7px;
    font-size: 0.85rem;
}

.batch-c-detail ul {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.batch-c-detail li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8rem;
}

.batch-c-detail li strong,
.batch-c-detail li span {
    display: block;
}

.batch-c-detail li span,
.batch-c-detail li small {
    margin-top: 2px;
    color: #64748b;
}

.batch-c-empty {
    padding: 28px 12px !important;
    color: #64748b;
    text-align: center;
}

.batch-c-empty.is-error,
.batch-c-form-error { color: #b91c1c; }

.batch-c-dialog-backdrop,
.batch-c-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgb(15 23 42 / 48%);
}

.batch-c-dialog-backdrop[hidden],
.batch-c-drawer-backdrop[hidden] { display: none; }

.batch-c-dialog {
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    margin: 24px auto;
    padding: 20px;
    overflow-y: auto;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 48px rgb(15 23 42 / 25%);
}

.batch-c-dialog header,
.batch-c-document-drawer header,
.batch-c-dialog footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.batch-c-dialog h2,
.batch-c-document-drawer h2 {
    margin: 0;
    font-size: 1.05rem;
}

.batch-c-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    cursor: pointer;
}

.batch-c-dialog-summary {
    display: flex;
    gap: 14px;
    margin: 16px 0;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    background: #eff6ff;
}

.batch-c-document-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 0 0 16px;
    padding: 12px;
    border: 1px solid #dbe3ec;
    border-radius: 6px;
}

.batch-c-document-types legend,
.batch-c-preview-label {
    color: #334155;
    font-size: 0.82rem;
    font-weight: 800;
}

.batch-c-document-types label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#batch-c-message-preview {
    width: 100%;
    margin: 6px 0 12px;
    resize: vertical;
}

.batch-c-form-error {
    margin-bottom: 12px;
    font-size: 0.84rem;
}

.batch-c-dialog footer {
    justify-content: flex-end;
}

.batch-c-document-drawer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 88vh;
    padding: 16px;
    overflow-y: auto;
    border-radius: 8px 8px 0 0;
    background: #fff;
    box-shadow: 0 -10px 32px rgb(15 23 42 / 22%);
}

.batch-c-drawer-content {
    margin-top: 12px;
}

body.batch-c-drawer-open {
    overflow: hidden;
}

@media (max-width: 1100px) and (min-width: 768px) {
    .batch-c-document-summary {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }

    .batch-c-document-layout {
        grid-template-columns: minmax(0, 1fr) 300px !important;
    }
}

@media (max-width: 767px) {
    .batch-c-documents-container {
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .batch-c-document-header {
        padding: 14px !important;
    }

    .batch-c-document-header > div:first-child {
        display: grid !important;
        grid-template-columns: 1fr;
    }

    .batch-c-scope-toggle {
        margin-left: 0;
    }

    .batch-c-bulk-request {
        width: 100%;
        justify-content: center;
    }

    .batch-c-document-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .batch-c-summary-item span {
        min-height: 0;
    }

    .batch-c-document-filters {
        padding: 10px !important;
        overflow: hidden;
    }

    .batch-c-stage-filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .batch-c-stage-filters .tab-btn {
        min-width: 0;
        padding: 7px 5px;
        white-space: normal;
    }

    .batch-c-document-layout {
        display: block !important;
    }

    .batch-c-table-scroller,
    .batch-c-desktop-detail {
        display: none !important;
    }

    .batch-c-document-card-list {
        display: grid;
        gap: 10px;
        padding: 10px;
    }

    .batch-c-document-card {
        display: grid;
        gap: 10px;
        padding: 13px;
        border: 1px solid #dbe3ec;
        border-radius: 7px;
        background: #fff;
        box-shadow: 0 1px 3px rgb(15 23 42 / 7%);
    }

    .batch-c-card-heading {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
    }

    .batch-c-card-heading strong,
    .batch-c-card-heading span {
        display: block;
    }

    .batch-c-card-heading span {
        margin-top: 2px;
        color: #64748b;
        font-size: 0.78rem;
    }

    .batch-c-card-status {
        display: grid;
        gap: 2px;
    }

    .batch-c-document-card dl {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin: 0;
    }

    .batch-c-document-card dl > div {
        padding: 8px;
        border-radius: 5px;
        background: #f8fafc;
    }

    .batch-c-document-card dt {
        color: #64748b;
        font-size: 0.72rem;
    }

    .batch-c-document-card dd {
        margin: 2px 0 0;
        color: #0f172a;
        font-weight: 800;
    }

    .batch-c-dialog {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        margin: 8px;
        padding: 14px;
    }

    .batch-c-dialog footer {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}
