:root{
    --app:#4f46e5;
    --app-dark:#312e81;
    --soft:#f4f6fb;
    --card:#ffffff;
    --text:#1f2937;
    --muted:#6b7280;
    --border:#e5e7eb;
}
*{box-sizing:border-box}
body{
    font-family:'Sarabun',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    background:linear-gradient(180deg,#f7f7ff 0,#f8fafc 260px,#f8fafc 100%);
    color:var(--text);
}
.app-navbar{background:linear-gradient(135deg,var(--app-dark),var(--app));box-shadow:0 10px 30px rgba(49,46,129,.18)}
.app-card{background:var(--card);border:1px solid var(--border);border-radius:18px;box-shadow:0 12px 30px rgba(15,23,42,.06)}
.app-card .card-header{background:transparent;border-bottom:1px solid var(--border);padding:18px 22px;font-weight:700}
.app-card .card-body{padding:22px}
.btn-primary{background:var(--app);border-color:var(--app)}
.btn-primary:hover{background:var(--app-dark);border-color:var(--app-dark)}
.stat-card{border-radius:18px;padding:20px;background:#fff;border:1px solid var(--border);box-shadow:0 12px 30px rgba(15,23,42,.06);height:100%}
.stat-icon{width:46px;height:46px;border-radius:15px;background:#eef2ff;color:var(--app);display:flex;align-items:center;justify-content:center;font-size:20px}
.stat-number{font-size:30px;font-weight:800;line-height:1}.muted{color:var(--muted)}
.table thead th{background:#f8fafc;color:#374151;border-bottom:1px solid var(--border);white-space:nowrap}.table td{vertical-align:middle}
.badge-soft{background:#eef2ff;color:#3730a3;border:1px solid #c7d2fe}.badge-warn{background:#fff7ed;color:#9a3412;border:1px solid #fed7aa}.badge-ok{background:#ecfdf5;color:#047857;border:1px solid #a7f3d0}.badge-danger-soft{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}
.form-label{font-weight:700}.required:after{content:' *';color:#dc2626}.help-text{font-size:.9rem;color:#6b7280}
.quick-btn{border-radius:999px}.timeline-item{position:relative;padding-left:28px;border-left:3px solid #e0e7ff;margin-left:8px;padding-bottom:22px}.timeline-dot{position:absolute;left:-10px;top:0;width:18px;height:18px;background:var(--app);border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 2px #c7d2fe}.evidence-thumb{max-width:160px;max-height:120px;object-fit:cover;border-radius:12px;border:1px solid var(--border)}
.login-wrap{min-height:calc(100vh - 60px);display:flex;align-items:center;justify-content:center;padding:30px}.login-card{width:100%;max-width:440px}
.print-only{display:none}
@media print{
    nav,.no-print,.btn,.alert{display:none!important}
    body{background:#fff!important;font-size:14px}
    main{padding:0!important}.app-card{box-shadow:none!important;border:0!important;border-radius:0!important}.card-body{padding:0!important}.print-only{display:block}.table{font-size:13px}.page-break{page-break-before:always}
}

/* Thai date/time selector */
.thai-date-picker .form-select,
.thai-time-picker .form-select {
    font-weight: 600;
}
.thai-date-preview,
.thai-time-preview {
    color: #5f6368;
}

.thai-date-preview {
    color: #4f46e5;
    font-weight: 600;
}

/* Contact text templates */
.template-card .card-body {
    max-height: calc(100vh - 170px);
    overflow-y: auto;
}
.template-accordion .accordion-item {
    border-color: var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 10px;
}
.template-accordion .accordion-button {
    font-weight: 700;
    padding: 12px 14px;
    background: #f8fafc;
}
.template-accordion .accordion-button:not(.collapsed) {
    color: var(--app-dark);
    background: #eef2ff;
    box-shadow: none;
}
.template-accordion .accordion-body {
    display: grid;
    gap: 8px;
    padding: 12px;
}
.template-btn {
    width: 100%;
    text-align: left;
    border-radius: 12px;
    font-size: .93rem;
    line-height: 1.35;
    white-space: normal;
}
.template-preview {
    border: 1px dashed #c7d2fe;
    border-radius: 14px;
    padding: 12px;
    background: #f8faff;
    color: #374151;
    font-size: .92rem;
    line-height: 1.6;
}
@media (max-width: 991.98px) {
    .template-card .card-body {
        max-height: none;
    }
}

/* Court-ready evidence report */
.court-report {
    color: #111827;
}
.court-body {
    max-width: 1120px;
    margin: 0 auto;
    background: #fff;
}
.court-cover {
    min-height: 820px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 26px 18px;
    text-align: center;
}
.court-doc-label {
    display: inline-block;
    margin: 0 auto 18px;
    padding: 6px 18px;
    border: 1px solid #111827;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: .04em;
}
.court-cover h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}
.court-subtitle {
    color: #4b5563;
    font-size: 1.05rem;
}
.court-section {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 2px solid #111827;
}
.court-section h3 {
    font-weight: 800;
    font-size: 1.35rem;
    margin-bottom: 14px;
}
.court-small-title {
    font-weight: 800;
    font-size: 1.05rem;
    margin: 12px 0 8px;
}
.court-info-table,
.court-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.court-info-table th,
.court-info-table td,
.court-table th,
.court-table td {
    border: 1px solid #9ca3af;
    padding: 8px 10px;
    vertical-align: top;
    line-height: 1.55;
}
.court-info-table th {
    width: 210px;
    background: #f3f4f6;
    font-weight: 800;
}
.court-table thead th {
    background: #e5e7eb;
    color: #111827;
    font-weight: 800;
    text-align: center;
}
.court-table.compact th,
.court-table.compact td {
    padding: 6px 8px;
    font-size: .95rem;
}
.court-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.court-summary-card {
    border: 1px solid #9ca3af;
    padding: 14px;
    text-align: center;
    background: #f9fafb;
    border-radius: 10px;
}
.court-summary-card .num {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}
.court-note-box {
    border: 1px solid #9ca3af;
    background: #f9fafb;
    border-radius: 10px;
    padding: 12px 14px;
    text-align: left;
    line-height: 1.7;
}
.court-signature-cover {
    margin-top: 80px;
    text-align: center;
    line-height: 2.2;
}
.court-event {
    border: 1px solid #9ca3af;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 18px;
    page-break-inside: avoid;
    background: #fff;
}
.court-event-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 10px;
    margin-bottom: 12px;
}
.court-event-head h4 {
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0 0 4px;
}
.court-badge {
    display: inline-block;
    border: 1px solid #6b7280;
    background: #f3f4f6;
    color: #111827;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 800;
    white-space: nowrap;
}
.court-badge-ok {
    background: #ecfdf5;
    border-color: #34d399;
    color: #065f46;
}
.court-badge-warn {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}
.court-badge-danger {
    background: #fef2f2;
    border-color: #f87171;
    color: #991b1b;
}
.court-evidence-list ol {
    margin-top: 6px;
    margin-bottom: 0;
}
.hash-cell,
.hash-line {
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .82rem;
}
.court-attachment {
    border: 1px solid #9ca3af;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 18px;
    background: #fff;
}
.court-attachment h4 {
    font-weight: 800;
    font-size: 1.1rem;
}
.court-attachment-image {
    display: block;
    max-width: 100%;
    max-height: 780px;
    object-fit: contain;
    margin: 10px auto 0;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}
.court-signature-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 50px;
}
.court-signature-box {
    min-height: 150px;
    text-align: center;
    line-height: 2.2;
    padding-top: 24px;
}
.page-break-inside-avoid {
    page-break-inside: avoid;
}
@media (max-width: 991.98px) {
    .court-summary-grid,
    .court-signature-row {
        grid-template-columns: 1fr;
    }
    .court-info-table th {
        width: 150px;
    }
}
@media print {
    @page {
        size: A4 portrait;
        margin: 14mm 12mm 14mm 12mm;
    }
    .court-body {
        max-width: none;
        width: 100%;
        padding: 0 !important;
    }
    .court-cover {
        min-height: 255mm;
        padding: 0;
    }
    .court-cover h2 {
        font-size: 24pt;
    }
    .court-section {
        border-top: 1.5pt solid #111827;
        margin-top: 14mm;
        padding-top: 7mm;
    }
    .page-break-print {
        page-break-before: always;
    }
    .court-table th,
    .court-table td,
    .court-info-table th,
    .court-info-table td {
        border-color: #000 !important;
    }
    .court-summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .court-summary-card {
        border-color: #000;
        border-radius: 0;
    }
    .court-badge {
        border-color: #000;
        color: #000;
        background: #fff;
    }
    .court-event,
    .court-attachment,
    .court-note-box {
        border-color: #000;
        border-radius: 0;
    }
    .court-attachment-image {
        max-height: 215mm;
        border-color: #000;
    }
    a[href]:after {
        content: none !important;
    }
}

/* Mobile-first usability improvements */
.mobile-bottom-nav { display: none; }
.mobile-contact-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.mobile-contact-date {
    color: var(--app-dark);
    font-weight: 700;
    line-height: 1.45;
}
.mobile-contact-purpose {
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 10px 12px;
    line-height: 1.55;
}
.mobile-template-jump {
    border-style: dashed;
    font-weight: 700;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 767.98px) {
    body {
        padding-bottom: 86px;
        background: #f8fafc;
    }
    main.container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-top: 14px !important;
    }
    .navbar-brand {
        max-width: calc(100vw - 84px);
        white-space: normal;
        line-height: 1.25;
        font-size: .98rem;
    }
    .navbar-collapse {
        padding-top: 12px;
    }
    .navbar-nav .nav-link {
        padding: 10px 4px;
        font-size: 1rem;
    }
    .app-card,
    .stat-card {
        border-radius: 16px;
        box-shadow: 0 8px 18px rgba(15,23,42,.06);
    }
    .app-card .card-header {
        padding: 14px 16px;
        font-size: 1.02rem;
    }
    .app-card .card-body {
        padding: 16px;
    }
    .h3, h1.h3 {
        font-size: 1.34rem;
    }
    .form-label {
        margin-bottom: 6px;
    }
    .form-control,
    .form-select,
    .input-group-text,
    .btn {
        min-height: 48px;
        font-size: 16px;
    }
    textarea.form-control {
        min-height: 150px;
        line-height: 1.65;
    }
    .help-text {
        font-size: .86rem;
        line-height: 1.45;
    }
    .thai-date-picker .row {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr) 96px;
        gap: 8px;
        margin-left: 0;
        margin-right: 0;
    }
    .thai-date-picker .row > * {
        width: auto;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }
    .thai-date-preview,
    .thai-time-preview {
        background: #eef2ff;
        border: 1px solid #c7d2fe;
        border-radius: 12px;
        padding: 8px 10px;
        margin-top: 8px !important;
        line-height: 1.45;
    }
    .thai-time-picker .input-group .form-select {
        min-width: 0;
    }
    .form-action-bar {
        position: sticky;
        bottom: 70px;
        z-index: 1020;
        background: rgba(255,255,255,.96);
        border: 1px solid var(--border);
        box-shadow: 0 -10px 24px rgba(15,23,42,.10);
        border-radius: 16px;
        padding: 10px;
        margin-left: -4px;
        margin-right: -4px;
    }
    .form-action-bar .btn {
        flex: 1 1 0;
        white-space: normal;
        line-height: 1.25;
    }
    .template-card .card-body {
        max-height: none;
    }
    .template-btn {
        min-height: 52px;
        padding: 10px 12px;
    }
    .template-preview {
        font-size: .9rem;
    }
    .mobile-contact-card .btn-group .btn {
        min-height: 40px;
        font-size: .92rem;
    }
    form.app-card .card-body .row > [class*="col-md-"] {
        margin-bottom: 2px;
    }
    .btn-group {
        max-width: 100%;
    }
    .btn-group .btn {
        white-space: normal;
    }
    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 64px;
        background: rgba(255,255,255,.98);
        border-top: 1px solid var(--border);
        box-shadow: 0 -8px 24px rgba(15,23,42,.12);
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        z-index: 1030;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .mobile-bottom-nav a {
        color: #4b5563;
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: .74rem;
        font-weight: 700;
        line-height: 1.1;
    }
    .mobile-bottom-nav i {
        font-size: 1.1rem;
    }
    .mobile-bottom-nav .mobile-bottom-add {
        color: var(--app);
    }
    .mobile-bottom-nav .mobile-bottom-add i {
        width: 42px;
        height: 42px;
        margin-top: -28px;
        border-radius: 50%;
        color: #fff;
        background: linear-gradient(135deg, var(--app-dark), var(--app));
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 10px 22px rgba(79,70,229,.35);
        border: 4px solid #fff;
    }
}

@media (max-width: 390px) {
    .thai-date-picker .row {
        grid-template-columns: 64px minmax(0, 1fr) 86px;
        gap: 6px;
    }
    .thai-date-picker .form-select {
        padding-left: 8px;
        padding-right: 26px;
    }
    .mobile-contact-card {
        padding: 12px;
    }
}

@media print {
    .mobile-bottom-nav,
    .form-action-bar {
        display: none !important;
    }
}

/* Professional court-style report v2 */
.court-report-pro {
    max-width: 1120px;
    margin: 0 auto;
    background: #f3f4f6;
    color: #111827;
    font-family: 'Sarabun', 'Tahoma', sans-serif;
}
.court-page {
    background: #fff;
    margin: 0 auto 18px;
    padding: 34px 38px;
    border: 1px solid #d1d5db;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
    line-height: 1.65;
    font-size: 15px;
}
.court-cover-pro {
    min-height: 930px;
    display: flex;
    flex-direction: column;
}
.court-topline {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 2px solid #111827;
    padding-bottom: 10px;
    font-weight: 700;
    font-size: 14px;
}
.court-cover-titlebox {
    margin: 78px auto 42px;
    text-align: center;
    border: 2px solid #111827;
    padding: 32px 42px;
    width: min(760px, 100%);
}
.court-cover-titlebox .court-mark {
    display: inline-block;
    padding: 4px 16px;
    border: 1px solid #111827;
    font-weight: 800;
    letter-spacing: .04em;
    margin-bottom: 16px;
}
.court-cover-titlebox h2 {
    font-size: 31px;
    line-height: 1.25;
    margin: 0 0 10px;
    font-weight: 900;
}
.court-cover-titlebox p {
    margin: 0;
    color: #374151;
    font-size: 16px;
}
.court-meta-table,
.court-formal-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.court-meta-table th,
.court-meta-table td,
.court-formal-table th,
.court-formal-table td {
    border: 1px solid #111827;
    padding: 8px 10px;
    vertical-align: top;
}
.court-meta-table th {
    width: 230px;
    background: #f3f4f6;
    font-weight: 800;
    text-align: left;
}
.court-formal-table thead th {
    background: #e5e7eb;
    font-weight: 900;
    text-align: center;
}
.court-small-table th,
.court-small-table td {
    padding: 6px 8px;
    font-size: 14px;
}
.court-statement-box {
    border: 1.5px solid #111827;
    background: #fafafa;
    padding: 12px 14px;
    margin-top: 18px;
}
.court-statement-box p {
    margin: 6px 0 0;
    text-indent: 1.5em;
}
.court-statement-title,
.court-heading,
.court-subheading {
    font-weight: 900;
    color: #111827;
}
.court-heading {
    font-size: 21px;
    padding-bottom: 8px;
    border-bottom: 2px solid #111827;
    margin-bottom: 16px;
}
.court-subheading {
    font-size: 16px;
    margin: 14px 0 8px;
}
.court-sign-line {
    text-align: center;
    line-height: 2.1;
}
.cover-sign {
    margin-top: auto;
    padding-top: 60px;
}
.court-summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.court-summary-strip > div {
    border: 1.5px solid #111827;
    padding: 12px 10px;
    text-align: center;
    background: #fff;
}
.court-summary-strip strong {
    display: block;
    font-size: 28px;
    line-height: 1;
    margin-bottom: 6px;
}
.court-summary-strip span {
    display: block;
    font-weight: 700;
    font-size: 13px;
}
.court-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.court-timeline-table th,
.court-timeline-table td {
    font-size: 13.5px;
    line-height: 1.55;
}
.court-ref,
.court-muted {
    color: #4b5563;
    font-size: 12.5px;
}
.court-status {
    display: inline-block;
    border: 1px solid #111827;
    padding: 3px 8px;
    font-weight: 800;
    background: #fff;
    color: #111827;
    font-size: 12.5px;
}
.court-status.status-ok { background: #f0fdf4; }
.court-status.status-pending { background: #fffbeb; }
.court-status.status-issue { background: #fef2f2; }
.court-status.status-neutral { background: #f9fafb; }
.court-event-pro {
    border: 1.5px solid #111827;
    padding: 14px;
    margin-bottom: 18px;
    background: #fff;
}
.court-event-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 1px solid #111827;
    padding-bottom: 10px;
    margin-bottom: 12px;
}
.court-event-title h4 {
    margin: 2px 0 0;
    font-size: 18px;
    font-weight: 900;
}
.court-event-no {
    font-weight: 800;
    color: #374151;
}
.event-detail-table th {
    width: 215px;
}
.court-evidence-box,
.court-audit-box {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #111827;
    background: #fcfcfc;
}
.court-evidence-ordered {
    margin: 4px 0 0 22px;
    padding: 0;
}
.court-evidence-ordered li {
    margin-bottom: 8px;
}
.court-hash,
.court-hash-cell,
.court-hash-inline {
    font-family: Consolas, 'Courier New', monospace;
    word-break: break-all;
    font-size: 12px;
    color: #111827;
}
.court-attachment-index th,
.court-attachment-index td {
    font-size: 12.5px;
    line-height: 1.45;
}
.court-appendix-item {
    border: 1.5px solid #111827;
    padding: 12px;
    margin-bottom: 18px;
    background: #fff;
}
.court-appendix-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #111827;
    padding-bottom: 8px;
    margin-bottom: 8px;
}
.court-appendix-image {
    display: block;
    max-width: 100%;
    max-height: 760px;
    object-fit: contain;
    margin: 10px auto 0;
    border: 1px solid #111827;
}
.court-certify-pro p {
    text-indent: 2em;
}
.court-signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 34px;
    margin-top: 52px;
}
.court-sign-block {
    min-height: 155px;
    text-align: center;
    line-height: 2.25;
    padding-top: 26px;
}
.page-break-inside-avoid {
    page-break-inside: avoid;
    break-inside: avoid;
}
@media (max-width: 991.98px) {
    .court-page {
        padding: 18px 14px;
        font-size: 14px;
        overflow-x: auto;
    }
    .court-cover-pro { min-height: auto; }
    .court-topline,
    .court-event-title,
    .court-appendix-head {
        display: block;
    }
    .court-cover-titlebox {
        margin: 28px auto 22px;
        padding: 20px 14px;
    }
    .court-cover-titlebox h2 { font-size: 24px; }
    .court-summary-strip,
    .court-two-col,
    .court-signature-grid {
        grid-template-columns: 1fr;
    }
    .court-meta-table th { width: 145px; }
}
@media print {
    @page {
        size: A4 portrait;
        margin: 12mm 10mm 14mm 10mm;
    }
    body {
        background: #fff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .app-shell,
    .app-main,
    .content-wrap {
        padding: 0 !important;
        margin: 0 !important;
        background: #fff !important;
    }
    .court-report-pro {
        max-width: none;
        background: #fff;
    }
    .court-page {
        width: 100%;
        min-height: auto;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        font-size: 11.5pt;
        line-height: 1.55;
    }
    .court-cover-pro {
        min-height: 268mm;
        padding-top: 2mm;
    }
    .court-cover-titlebox {
        margin-top: 35mm;
        padding: 12mm 10mm;
    }
    .court-cover-titlebox h2 {
        font-size: 23pt;
    }
    .court-heading {
        font-size: 15.5pt;
        margin-bottom: 6mm;
        padding-bottom: 2mm;
    }
    .court-subheading { font-size: 12.5pt; }
    .court-formal-table th,
    .court-formal-table td,
    .court-meta-table th,
    .court-meta-table td {
        border-color: #000 !important;
        padding: 5px 6px;
    }
    .court-timeline-table th,
    .court-timeline-table td {
        font-size: 9.6pt;
        line-height: 1.42;
    }
    .court-small-table th,
    .court-small-table td,
    .court-attachment-index th,
    .court-attachment-index td {
        font-size: 9.5pt;
    }
    .court-summary-strip {
        grid-template-columns: repeat(4, 1fr);
    }
    .court-summary-strip > div,
    .court-event-pro,
    .court-evidence-box,
    .court-audit-box,
    .court-appendix-item,
    .court-statement-box {
        border-color: #000 !important;
    }
    .court-status {
        background: #fff !important;
        border-color: #000 !important;
        color: #000 !important;
    }
    .page-break-print {
        page-break-before: always;
        break-before: page;
    }
    .page-break-inside-avoid {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .court-appendix-image {
        max-height: 220mm;
        border-color: #000 !important;
    }
    .court-ref,
    .court-muted {
        color: #333 !important;
    }
    a[href]::after { content: none !important; }
}

/* =========================================================
   Legal Evidence Report v3 - professional A4 print layout
   ========================================================= */
.legal-report-v3 {
    --legal-ink: #111827;
    --legal-muted: #4b5563;
    --legal-line: #1f2937;
    --legal-soft-line: #d1d5db;
    --legal-soft: #f8fafc;
    --legal-head: #e5e7eb;
    --legal-blue: #1e3a8a;
    --legal-blue-soft: #eff6ff;
    --legal-green-soft: #ecfdf5;
    --legal-yellow-soft: #fffbeb;
    --legal-red-soft: #fef2f2;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0;
    color: var(--legal-ink);
    background: #eef2f7;
    font-family: 'Sarabun', 'TH Sarabun New', 'Tahoma', sans-serif;
    counter-reset: legal-page;
}
.legal-report-v3 * {
    box-sizing: border-box;
}
.legal-page {
    position: relative;
    background: #fff;
    margin: 0 auto 18px;
    padding: 34px 38px 38px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .10);
    line-height: 1.62;
    font-size: 15px;
    counter-increment: legal-page;
}
.legal-page::after {
    content: "หน้า " counter(legal-page);
    position: absolute;
    right: 38px;
    bottom: 14px;
    color: #64748b;
    font-size: 12px;
}
.legal-cover::after {
    content: "";
}
.legal-cover {
    min-height: 930px;
    display: flex;
    flex-direction: column;
    border-top: 9px solid var(--legal-blue);
}
.legal-cover-top {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 3px double var(--legal-line);
    font-size: 14px;
    font-weight: 800;
}
.legal-brand {
    letter-spacing: .02em;
    color: var(--legal-blue);
    text-transform: uppercase;
}
.legal-report-no {
    padding: 6px 12px;
    border: 1px solid var(--legal-line);
    background: var(--legal-soft);
}
.legal-cover-center {
    width: min(790px, 100%);
    margin: 68px auto 35px;
    padding: 34px 46px;
    text-align: center;
    border: 2px solid var(--legal-line);
    background:
        linear-gradient(180deg, rgba(30,58,138,.06), rgba(255,255,255,0) 42%),
        #fff;
}
.legal-doc-type {
    display: inline-block;
    padding: 5px 18px;
    margin-bottom: 16px;
    border: 1px solid var(--legal-line);
    background: var(--legal-blue);
    color: #fff;
    font-weight: 900;
    letter-spacing: .05em;
}
.legal-cover-center h2 {
    margin: 0 0 10px;
    font-size: 32px;
    line-height: 1.25;
    font-weight: 900;
    color: var(--legal-ink);
}
.legal-cover-center p {
    margin: 0;
    font-size: 16px;
    color: var(--legal-muted);
}
.legal-info-table,
.legal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}
.legal-info-table th,
.legal-info-table td,
.legal-table th,
.legal-table td {
    border: 1px solid var(--legal-line);
    padding: 8px 10px;
    vertical-align: top;
    word-break: break-word;
}
.legal-info-table th {
    width: 225px;
    background: #f1f5f9;
    font-weight: 900;
    text-align: left;
    color: #0f172a;
}
.legal-table thead th {
    background: #dbe4f0;
    color: #0f172a;
    font-weight: 900;
    text-align: center;
    vertical-align: middle;
}
.legal-table tbody tr:nth-child(even) td {
    background: #fcfdff;
}
.legal-table-compact th,
.legal-table-compact td {
    padding: 6px 8px;
    font-size: 13.5px;
    line-height: 1.45;
}
.legal-cover-table {
    margin-top: 6px;
}
.legal-note-box {
    margin-top: 18px;
    padding: 13px 15px;
    border: 1.5px solid var(--legal-line);
    background: #f8fafc;
}
.legal-note-box.compact {
    margin-top: 10px;
    padding: 10px 12px;
}
.legal-note-box h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 900;
    color: var(--legal-blue);
}
.legal-note-box p {
    margin: 5px 0 0;
    text-indent: 1.6em;
}
.legal-sign-cover {
    margin-top: auto;
    padding-top: 62px;
    text-align: center;
    line-height: 2.2;
}
.legal-section-title {
    margin: 0 0 16px;
    padding: 0 0 9px;
    border-bottom: 3px double var(--legal-line);
    font-size: 21px;
    line-height: 1.3;
    font-weight: 900;
    color: var(--legal-blue);
}
.legal-section-title::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 21px;
    margin-right: 8px;
    border-radius: 3px;
    background: var(--legal-blue);
    vertical-align: -4px;
}
.legal-subtitle {
    margin: 14px 0 8px;
    font-size: 16px;
    font-weight: 900;
    color: #0f172a;
}
.legal-mini-title {
    margin: 12px 0 6px;
    font-size: 14px;
    font-weight: 900;
    color: #0f172a;
}
.legal-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.legal-kpi {
    min-height: 88px;
    padding: 14px 12px;
    border: 1.5px solid var(--legal-line);
    background: var(--legal-blue-soft);
    text-align: center;
}
.legal-kpi span {
    display: block;
    margin-bottom: 8px;
    font-size: 30px;
    line-height: 1;
    font-weight: 900;
    color: var(--legal-blue);
}
.legal-kpi strong {
    display: block;
    font-size: 13px;
    line-height: 1.35;
    color: #0f172a;
}
.legal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
.legal-table-note {
    margin: -4px 0 10px;
    padding: 8px 10px;
    border-left: 5px solid var(--legal-blue);
    background: #f8fafc;
    color: #334155;
    font-size: 13.5px;
}
.legal-main-timeline th,
.legal-main-timeline td {
    font-size: 12.6px;
    line-height: 1.45;
    padding: 7px 8px;
}
.legal-main-timeline tbody tr,
.legal-audit-summary tbody tr,
.legal-follow-table tbody tr,
.legal-attachment-index tbody tr {
    page-break-inside: avoid;
    break-inside: avoid;
}
.legal-ref,
.legal-muted {
    color: var(--legal-muted);
    font-size: 12px;
    line-height: 1.35;
}
.legal-status,
.legal-check {
    display: inline-block;
    min-width: 74px;
    padding: 3px 7px;
    border: 1px solid var(--legal-line);
    border-radius: 999px;
    text-align: center;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 900;
    color: #0f172a;
    background: #fff;
}
.legal-status.ok,
.legal-check.check-ok {
    background: var(--legal-green-soft);
}
.legal-status.pending,
.legal-check.check-warn {
    background: var(--legal-yellow-soft);
}
.legal-status.issue {
    background: var(--legal-red-soft);
}
.legal-status.neutral {
    background: #f8fafc;
}
.legal-check-table th,
.legal-check-table td {
    font-size: 13.5px;
    line-height: 1.45;
}
.legal-related-table th,
.legal-related-table td,
.legal-audit-summary th,
.legal-audit-summary td,
.legal-follow-table th,
.legal-follow-table td {
    font-size: 12.8px;
    line-height: 1.45;
}
.legal-event-card {
    margin: 0 0 18px;
    padding: 14px;
    border: 2px solid var(--legal-line);
    background: #fff;
}
.legal-event-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: start;
    margin: -14px -14px 12px;
    padding: 11px 14px;
    border-bottom: 1.5px solid var(--legal-line);
    background: #f8fafc;
}
.legal-event-ref {
    margin-bottom: 3px;
    color: var(--legal-blue);
    font-size: 13px;
    font-weight: 900;
}
.legal-event-header h4 {
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
    font-weight: 900;
}
.legal-event-table th {
    width: 215px;
}
.legal-event-evidence-table th,
.legal-event-evidence-table td {
    font-size: 12.4px;
}
.legal-hash-cell,
.legal-hash-inline {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 11.5px;
    line-height: 1.3;
    word-break: break-all;
    color: #111827;
}
.legal-attachment-index th,
.legal-attachment-index td {
    font-size: 12px;
    line-height: 1.42;
}
.legal-appendix-card {
    margin: 0 0 20px;
    padding: 12px;
    border: 2px solid var(--legal-line);
    background: #fff;
}
.legal-appendix-meta {
    margin-bottom: 12px;
}
.legal-appendix-meta th {
    width: 145px;
}
.legal-appendix-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 760px;
    object-fit: contain;
    margin: 8px auto 0;
    border: 1px solid var(--legal-line);
    background: #fff;
}
.legal-final p {
    text-indent: 2em;
}
.legal-signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 34px;
    margin-top: 50px;
}
.legal-sign-block {
    min-height: 155px;
    padding-top: 26px;
    text-align: center;
    line-height: 2.25;
    border-top: 1px dashed #94a3b8;
}
.page-break-inside-avoid {
    page-break-inside: avoid;
    break-inside: avoid;
}
@media (max-width: 991.98px) {
    .legal-report-v3 {
        background: transparent;
    }
    .legal-page {
        padding: 18px 14px 34px;
        overflow-x: auto;
        font-size: 14px;
    }
    .legal-page::after {
        right: 14px;
    }
    .legal-cover {
        min-height: auto;
    }
    .legal-cover-top,
    .legal-event-header {
        grid-template-columns: 1fr;
    }
    .legal-cover-center {
        margin: 28px auto 22px;
        padding: 20px 14px;
    }
    .legal-cover-center h2 {
        font-size: 24px;
    }
    .legal-grid-2,
    .legal-kpi-grid,
    .legal-signature-grid {
        grid-template-columns: 1fr;
    }
    .legal-info-table th {
        width: 140px;
    }
    .legal-table {
        min-width: 760px;
    }
    .legal-info-table {
        min-width: 620px;
    }
}
@media print {
    @page {
        size: A4 portrait;
        margin: 12mm 10mm 14mm 10mm;
    }
    body {
        background: #fff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .app-shell,
    .app-main,
    .content-wrap,
    main {
        padding: 0 !important;
        margin: 0 !important;
        background: #fff !important;
    }
    .legal-report-v3 {
        max-width: none !important;
        width: 100% !important;
        background: #fff !important;
        color: #000 !important;
    }
    .legal-page {
        width: 100% !important;
        min-height: auto;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 11.2pt;
        line-height: 1.48;
    }
    .legal-page::after {
        position: fixed;
        right: 0;
        bottom: -7mm;
        font-size: 9pt;
        color: #333 !important;
    }
    .legal-cover {
        min-height: 268mm;
        border-top: 0 !important;
    }
    .legal-cover-center {
        margin-top: 32mm;
        padding: 12mm 10mm;
    }
    .legal-cover-center h2 {
        font-size: 23pt;
    }
    .legal-section-title {
        font-size: 15.5pt;
        margin-bottom: 5mm;
        padding-bottom: 2mm;
        color: #000 !important;
    }
    .legal-section-title::before {
        background: #000 !important;
    }
    .legal-subtitle {
        font-size: 12.5pt;
    }
    .legal-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .legal-kpi {
        min-height: 22mm;
        padding: 4mm 2mm;
        background: #fff !important;
    }
    .legal-kpi span {
        font-size: 21pt;
        color: #000 !important;
    }
    .legal-grid-2 {
        grid-template-columns: 1fr 1fr;
        gap: 7mm;
    }
    .legal-table,
    .legal-info-table {
        table-layout: fixed;
        page-break-inside: auto;
    }
    .legal-table thead {
        display: table-header-group;
    }
    .legal-table tfoot {
        display: table-footer-group;
    }
    .legal-table th,
    .legal-table td,
    .legal-info-table th,
    .legal-info-table td {
        border-color: #000 !important;
        padding: 4px 5px;
    }
    .legal-table thead th,
    .legal-info-table th {
        background: #e5e5e5 !important;
        color: #000 !important;
    }
    .legal-table tbody tr:nth-child(even) td {
        background: #fff !important;
    }
    .legal-main-timeline th,
    .legal-main-timeline td {
        font-size: 8.9pt;
        line-height: 1.32;
        padding: 3px 4px;
    }
    .legal-table-compact th,
    .legal-table-compact td,
    .legal-related-table th,
    .legal-related-table td,
    .legal-audit-summary th,
    .legal-audit-summary td,
    .legal-follow-table th,
    .legal-follow-table td,
    .legal-attachment-index th,
    .legal-attachment-index td {
        font-size: 8.9pt;
        line-height: 1.32;
    }
    .legal-status,
    .legal-check {
        min-width: auto;
        border-color: #000 !important;
        background: #fff !important;
        color: #000 !important;
        border-radius: 0;
        padding: 2px 4px;
        font-size: 8.8pt;
    }
    .legal-note-box,
    .legal-event-card,
    .legal-appendix-card,
    .legal-kpi {
        border-color: #000 !important;
    }
    .legal-event-header {
        background: #eee !important;
        border-color: #000 !important;
    }
    .legal-ref,
    .legal-muted,
    .legal-event-ref {
        color: #333 !important;
        font-size: 8.7pt;
    }
    .legal-hash-cell,
    .legal-hash-inline {
        font-size: 7.9pt;
    }
    .legal-event-table th {
        width: 38mm;
    }
    .legal-appendix-image {
        max-height: 215mm;
        border-color: #000 !important;
    }
    .legal-signature-grid {
        grid-template-columns: 1fr 1fr;
    }
    .page-break-print {
        page-break-before: always;
        break-before: page;
    }
    .page-break-inside-avoid {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    a[href]::after {
        content: none !important;
    }
}

/* =========================================================
   Court Dossier Report v4 - clean, formal, A4-friendly
   ========================================================= */
.report-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid #dbe3ee;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
}
.court-dossier-v4 {
    --doc-ink: #111827;
    --doc-soft-ink: #374151;
    --doc-muted: #64748b;
    --doc-line: #243246;
    --doc-soft-line: #d8e0ec;
    --doc-soft: #f7f9fc;
    --doc-head: #edf2f8;
    --doc-navy: #172554;
    --doc-navy-2: #1e3a8a;
    --doc-gold: #b45309;
    --doc-green: #065f46;
    --doc-yellow: #92400e;
    --doc-red: #991b1b;
    max-width: 1120px;
    margin: 0 auto;
    color: var(--doc-ink);
    background: #eef3f8;
    font-family: 'Sarabun', 'TH Sarabun New', 'Tahoma', sans-serif;
    counter-reset: dossier-page;
}
.court-dossier-v4 * { box-sizing: border-box; }
.dossier-page {
    position: relative;
    width: 100%;
    min-height: 1020px;
    margin: 0 auto 20px;
    padding: 42px 46px 48px;
    background: #fff;
    border: 1px solid #d7deea;
    box-shadow: 0 24px 54px rgba(15, 23, 42, .10);
    line-height: 1.64;
    font-size: 15px;
    counter-increment: dossier-page;
}
.dossier-page::after {
    content: "หน้า " counter(dossier-page);
    position: absolute;
    right: 46px;
    bottom: 18px;
    color: var(--doc-muted);
    font-size: 12px;
}
.dossier-cover::after { content: ""; }
.dossier-cover { display: flex; flex-direction: column; padding-top: 0; }
.dossier-cover-line {
    height: 12px;
    margin: 0 -46px 30px;
    background: linear-gradient(90deg, var(--doc-navy) 0%, var(--doc-navy-2) 68%, var(--doc-gold) 68%, var(--doc-gold) 100%);
}
.dossier-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--doc-line);
}
.dossier-eyebrow {
    color: var(--doc-navy);
    font-weight: 900;
    letter-spacing: .04em;
    font-size: 18px;
}
.dossier-small { color: var(--doc-muted); font-weight: 600; }
.dossier-report-id {
    min-width: 210px;
    padding: 10px 14px;
    border: 1.5px solid var(--doc-line);
    background: #fbfdff;
    text-align: right;
}
.dossier-report-id span { display: block; font-size: 12px; color: var(--doc-muted); font-weight: 700; }
.dossier-report-id strong { display: block; font-size: 15px; color: var(--doc-ink); font-weight: 900; }
.dossier-title-box {
    width: min(820px, 100%);
    margin: 74px auto 34px;
    padding: 36px 46px 38px;
    text-align: center;
    border: 2.5px solid var(--doc-line);
    background:
        linear-gradient(180deg, rgba(30,58,138,.06), rgba(255,255,255,0) 44%),
        #fff;
    box-shadow: inset 0 0 0 8px #f8fafc;
}
.dossier-doc-label {
    display: inline-block;
    margin-bottom: 16px;
    padding: 6px 18px;
    border-radius: 999px;
    background: var(--doc-navy);
    color: #fff;
    font-weight: 900;
    letter-spacing: .06em;
}
.dossier-title-box h2 {
    margin: 0 0 12px;
    color: var(--doc-ink);
    font-size: 34px;
    line-height: 1.22;
    font-weight: 900;
}
.dossier-title-box p {
    margin: 0 auto;
    max-width: 650px;
    color: var(--doc-soft-ink);
    font-size: 16px;
}
.dossier-meta-table,
.dossier-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}
.dossier-meta-table th,
.dossier-meta-table td,
.dossier-table th,
.dossier-table td {
    border: 1px solid var(--doc-line);
    padding: 8px 10px;
    vertical-align: top;
    word-break: break-word;
}
.dossier-meta-table th {
    width: 224px;
    background: var(--doc-head);
    color: #0f172a;
    font-weight: 900;
    text-align: left;
}
.dossier-table thead th {
    background: var(--doc-navy);
    color: #fff;
    text-align: center;
    font-weight: 900;
    vertical-align: middle;
}
.dossier-table tbody tr:nth-child(even) td { background: #fbfdff; }
.dossier-table-sm th,
.dossier-table-sm td {
    padding: 6px 8px;
    font-size: 13px;
    line-height: 1.43;
}
.dossier-cover-meta { margin-top: 2px; }
.dossier-statement-box {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1.5px solid var(--doc-line);
    background: #f8fafc;
}
.dossier-statement-title {
    margin-bottom: 6px;
    color: var(--doc-navy);
    font-weight: 900;
    font-size: 15.5px;
}
.dossier-statement-box p {
    margin: 6px 0 0;
    text-indent: 1.65em;
}
.dossier-cover-sign {
    margin-top: auto;
    padding-top: 58px;
    text-align: center;
    line-height: 2.2;
}
.dossier-section-heading {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 3px double var(--doc-line);
}
.dossier-section-heading span {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--doc-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
}
.dossier-section-heading h3 {
    margin: 0;
    color: var(--doc-navy);
    font-size: 22px;
    line-height: 1.25;
    font-weight: 900;
}
.dossier-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.dossier-kpi-card {
    position: relative;
    min-height: 104px;
    padding: 15px 14px;
    border: 1.5px solid var(--doc-line);
    background: linear-gradient(180deg, #f8fbff, #fff);
    overflow: hidden;
}
.dossier-kpi-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--doc-gold);
}
.dossier-kpi-card small {
    display: block;
    color: var(--doc-muted);
    font-weight: 900;
    font-size: 12.5px;
}
.dossier-kpi-card strong {
    display: block;
    margin: 3px 0;
    color: var(--doc-navy);
    font-size: 34px;
    line-height: 1;
    font-weight: 900;
}
.dossier-kpi-card span { color: var(--doc-soft-ink); font-weight: 700; }
.dossier-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
.dossier-panel {
    border: 1.5px solid var(--doc-line);
    background: #fff;
    padding: 12px;
}
.dossier-panel h4,
.dossier-mini-title {
    margin: 0 0 9px;
    color: var(--doc-navy);
    font-size: 15.5px;
    font-weight: 900;
}
.dossier-mini-title { margin-top: 14px; }
.dossier-info-note {
    margin: -4px 0 12px;
    padding: 10px 12px;
    border-left: 6px solid var(--doc-gold);
    background: #fff7ed;
    color: #431407;
    font-size: 13.5px;
    font-weight: 650;
}
.dossier-muted { color: var(--doc-muted); font-size: 12px; line-height: 1.35; }
.dossier-ref { color: var(--doc-navy-2); font-weight: 900; font-size: 12px; }
.dossier-pill {
    display: inline-block;
    min-width: 68px;
    padding: 3px 8px;
    border: 1px solid var(--doc-line);
    border-radius: 999px;
    background: #fff;
    color: var(--doc-ink);
    font-size: 12px;
    line-height: 1.25;
    text-align: center;
    font-weight: 900;
}
.dossier-pill.success { background: #ecfdf5; color: var(--doc-green); border-color: #047857; }
.dossier-pill.warning { background: #fffbeb; color: var(--doc-yellow); border-color: #b45309; }
.dossier-pill.danger { background: #fef2f2; color: var(--doc-red); border-color: #b91c1c; }
.dossier-pill.secondary { background: #f8fafc; color: #334155; border-color: #64748b; }
.dossier-chronology-table th,
.dossier-chronology-table td {
    font-size: 12.1px;
    line-height: 1.38;
    padding: 6px 7px;
}
.dossier-event {
    margin: 0 0 18px;
    padding: 0;
    border: 2px solid var(--doc-line);
    background: #fff;
}
.dossier-event-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border-bottom: 1.5px solid var(--doc-line);
    background: #f8fafc;
}
.dossier-event-head h4 {
    margin: 2px 0 0;
    color: var(--doc-ink);
    font-size: 18px;
    line-height: 1.32;
    font-weight: 900;
}
.dossier-event-meta,
.dossier-evidence-table,
.dossier-event .dossier-table {
    margin: 12px;
    width: calc(100% - 24px);
}
.dossier-event-meta th { width: 215px; }
.dossier-evidence-table th,
.dossier-evidence-table td,
.dossier-attachment-index th,
.dossier-attachment-index td {
    font-size: 11.7px;
    line-height: 1.35;
}
.dossier-hash {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 10.7px;
    line-height: 1.38;
    word-break: break-word;
    color: #0f172a;
}
.dossier-appendix {
    margin: 0 0 20px;
    padding: 12px;
    border: 2px solid var(--doc-line);
    background: #fff;
}
.dossier-appendix-meta { margin-bottom: 12px; }
.dossier-appendix-meta th { width: 145px; }
.dossier-appendix-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 760px;
    object-fit: contain;
    margin: 10px auto 0;
    border: 1px solid var(--doc-line);
    background: #fff;
}
.dossier-final .dossier-statement-box p { text-indent: 2em; }
.dossier-signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 34px;
    margin-top: 54px;
}
.dossier-sign-box {
    min-height: 150px;
    padding-top: 25px;
    border-top: 1px dashed #94a3b8;
    text-align: center;
    line-height: 2.25;
}
.page-break-inside-avoid {
    page-break-inside: avoid;
    break-inside: avoid;
}
@media (max-width: 991.98px) {
    .report-action-bar { display: block; }
    .report-action-bar .btn { margin-top: 12px; width: 100%; }
    .court-dossier-v4 { background: transparent; }
    .dossier-page { min-height: auto; padding: 18px 14px 34px; overflow-x: auto; font-size: 14px; }
    .dossier-page::after { right: 14px; }
    .dossier-cover-line { margin-left: -14px; margin-right: -14px; }
    .dossier-top,
    .dossier-event-head { grid-template-columns: 1fr; }
    .dossier-report-id { text-align: left; }
    .dossier-title-box { margin: 30px auto 24px; padding: 22px 16px; }
    .dossier-title-box h2 { font-size: 24px; }
    .dossier-kpi-grid,
    .dossier-grid-2,
    .dossier-signature-grid { grid-template-columns: 1fr; }
    .dossier-meta-table { min-width: 620px; }
    .dossier-table { min-width: 780px; }
    .dossier-meta-table th { width: 150px; }
}
@media print {
    @page { size: A4 portrait; margin: 12mm 10mm 14mm 10mm; }
    body {
        background: #fff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .no-print,
    .navbar,
    .mobile-bottom-nav,
    .form-action-bar { display: none !important; }
    .app-shell,
    .app-main,
    .content-wrap,
    main,
    main.container-fluid {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        max-width: none !important;
        width: 100% !important;
    }
    .court-dossier-v4 {
        max-width: none !important;
        width: 100% !important;
        background: #fff !important;
        color: #000 !important;
    }
    .dossier-page {
        width: 100% !important;
        min-height: auto;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 10.9pt;
        line-height: 1.46;
    }
    .dossier-page::after {
        position: fixed;
        right: 0;
        bottom: -7mm;
        color: #333 !important;
        font-size: 9pt;
    }
    .dossier-cover { min-height: 268mm; }
    .dossier-cover-line { height: 5mm; margin: 0 0 11mm; background: #000 !important; }
    .dossier-top { border-bottom-color: #000 !important; }
    .dossier-title-box { margin-top: 30mm; padding: 12mm 10mm; box-shadow: none; border-color: #000 !important; }
    .dossier-doc-label { background: #000 !important; color: #fff !important; }
    .dossier-title-box h2 { font-size: 23pt; color: #000 !important; }
    .dossier-eyebrow,
    .dossier-section-heading h3,
    .dossier-panel h4,
    .dossier-mini-title,
    .dossier-ref { color: #000 !important; }
    .dossier-section-heading { margin-bottom: 5mm; padding-bottom: 2mm; border-bottom-color: #000 !important; }
    .dossier-section-heading span { background: #000 !important; color: #fff !important; }
    .dossier-kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 3mm; }
    .dossier-kpi-card { min-height: 22mm; padding: 4mm 3mm; background: #fff !important; border-color: #000 !important; }
    .dossier-kpi-card::before { background: #000 !important; }
    .dossier-kpi-card strong { color: #000 !important; font-size: 21pt; }
    .dossier-grid-2 { grid-template-columns: 1fr 1fr; gap: 6mm; }
    .dossier-panel,
    .dossier-statement-box,
    .dossier-event,
    .dossier-appendix { border-color: #000 !important; background: #fff !important; }
    .dossier-table,
    .dossier-meta-table { table-layout: fixed; page-break-inside: auto; }
    .dossier-table thead { display: table-header-group; }
    .dossier-table th,
    .dossier-table td,
    .dossier-meta-table th,
    .dossier-meta-table td { border-color: #000 !important; padding: 4px 5px; }
    .dossier-table thead th { background: #d9d9d9 !important; color: #000 !important; }
    .dossier-meta-table th { background: #efefef !important; color: #000 !important; }
    .dossier-table tbody tr:nth-child(even) td { background: #fff !important; }
    .dossier-table-sm th,
    .dossier-table-sm td,
    .dossier-chronology-table th,
    .dossier-chronology-table td,
    .dossier-evidence-table th,
    .dossier-evidence-table td,
    .dossier-attachment-index th,
    .dossier-attachment-index td { font-size: 8.8pt; line-height: 1.28; }
    .dossier-chronology-table th,
    .dossier-chronology-table td { padding: 3px 4px; }
    .dossier-event-head { background: #eee !important; border-color: #000 !important; }
    .dossier-event-head h4 { font-size: 12.5pt; }
    .dossier-event-meta th { width: 38mm; }
    .dossier-muted,
    .dossier-ref { font-size: 8.5pt; color: #333 !important; }
    .dossier-pill { border-radius: 0; background: #fff !important; color: #000 !important; border-color: #000 !important; font-size: 8.6pt; padding: 2px 4px; min-width: auto; }
    .dossier-hash { font-size: 7.6pt; line-height: 1.25; }
    .dossier-info-note { background: #fff !important; color: #000 !important; border-left-color: #000 !important; }
    .dossier-appendix-image { max-height: 215mm; border-color: #000 !important; }
    .dossier-signature-grid { grid-template-columns: 1fr 1fr; }
    .dossier-page-break { page-break-before: always; break-before: page; }
    .page-break-inside-avoid { page-break-inside: avoid; break-inside: avoid; }
    a[href]::after { content: none !important; }
}

/* ===== Court report: make chronology and appendix references match clearly ===== */
.dossier-appendix-event-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    margin: -12px -12px 12px;
    border-bottom: 2px solid var(--doc-line);
    background: linear-gradient(135deg, #f8fafc 0%, #fff7ed 100%);
}
.dossier-appendix-event-head h4 {
    margin: 3px 0 0;
    color: var(--doc-navy);
    font-size: 16px;
    line-height: 1.35;
    font-weight: 900;
}
.dossier-appendix-link-table {
    margin: 0 0 12px;
    border: 2px solid var(--doc-navy-2);
}
.dossier-appendix-link-table thead th {
    background: var(--doc-navy-2);
    color: #fff;
}
.dossier-appendix-evidence-card {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1.5px dashed #94a3b8;
}
.dossier-chronology-table td:last-child,
.dossier-attachment-index td:first-child,
.dossier-evidence-table td:first-child,
.dossier-appendix-meta td:first-child {
    color: var(--doc-navy);
    font-weight: 900;
}
@media print {
    .dossier-appendix-event-head {
        background: #f5f5f5 !important;
        border-color: #000 !important;
    }
    .dossier-appendix-link-table {
        border-color: #000 !important;
    }
    .dossier-appendix-link-table thead th {
        background: #111 !important;
        color: #fff !important;
    }
    .dossier-appendix-evidence-card {
        border-top-color: #000 !important;
    }
}

/* ===== Audio evidence support ===== */
.evidence-audio-player {
    width: 100%;
    max-width: 100%;
    display: block;
    border-radius: 12px;
}
.dossier-audio-box {
    margin-top: 10px;
    padding: 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
}
.dossier-audio-title {
    font-weight: 900;
    color: var(--doc-navy);
    margin-bottom: 8px;
}
.dossier-audio-player {
    width: 100%;
    display: block;
}
@media print {
    .dossier-audio-box {
        background: #fff !important;
        border-color: #000 !important;
    }
    .dossier-audio-player {
        display: none !important;
    }
    .dossier-audio-box::after {
        content: 'หมายเหตุ: ไฟล์เสียงไม่สามารถฝังในเอกสารกระดาษได้ ให้แนบไฟล์เสียงต้นฉบับประกอบรายงานฉบับพิมพ์';
        display: block;
        margin-top: 2mm;
        font-size: 9pt;
        font-weight: 700;
        color: #000;
    }
}
