/* Quy tắc responsive cho trình sửa và trình xem báo cáo trên thiết bị di động. */
@media screen and (max-width: 1023px) {
    :root {
        --gb-mobile-navy: #163746;
        --gb-mobile-teal: #256b62;
        --gb-mobile-line: #c8d8dc;
        --gb-mobile-surface: #f5f8f9;
        --gb-mobile-text: #20343d;
    }

    body.gb-report-full {
        overflow-x: hidden;
    }

    #gb-report-app {
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .gb-header,
    .gb-count-summary,
    .gb-patients,
    .gb-other-report,
    .gb-section-title,
    .gb-section-title-none {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    .gb-header-inner {
        padding: 12px !important;
    }

    .gb-title {
        font-size: 22px !important;
        line-height: 1.2;
    }

    .gb-meta {
        font-size: 16px !important;
        line-height: 1.4;
    }

    .gb-count-summary,
    .gb-patients {
        padding: 0 !important;
    }

    .gb-grid-row {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        flex-wrap: unset !important;
    }

    .gb-box {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        min-height: auto !important;
        padding: 11px 8px !important;
        border-color: var(--gb-mobile-line) !important;
        border-radius: 12px !important;
        background: linear-gradient(180deg, #fff, #edf5f5) !important;
    }

    .gb-box-label {
        font-size: 16px !important;
        line-height: 1.3;
    }

    .gb-box-value {
        margin-top: 4px !important;
        color: var(--gb-mobile-navy) !important;
        font-size: 23px !important;
    }

    .gb-other-report {
        margin: 7px 0 !important;
        padding: 11px !important;
        border-color: var(--gb-mobile-line) !important;
        background: var(--gb-mobile-surface) !important;
    }

    .gb-other-report .gb-other-content {
        font-size: 17px !important;
        line-height: 1.5 !important;
    }

    .gb-section-title,
    .gb-section-title-none {
        padding: 9px 11px !important;
        font-size: 18px !important;
    }

    .gb-list-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px;
    }

    .gb-list-action,
    .gb-btn-new {
        width: 100% !important;
    }

    .gb-table,
    .gb-report-table-render {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .gb-table th:last-child,
    .gb-table td:last-child {
        width: auto !important;
        min-width: 140px;
    }

    .col-updated,
    .gb-table th:nth-child(4),
    .gb-table td:nth-child(4) {
        display: none !important;
    }

    .gb-action-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px;
        white-space: normal !important;
    }

    .gb-action-buttons .button {
        width: 100% !important;
        margin: 0 !important;
    }

    .pc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .pc-header p,
    .pc-title,
    .pc-meta,
    .pc-room {
        font-size: 18px !important;
        line-height: 1.35;
    }

    /* Màu pha cho các báo cáo "vào và..." trên màn hình di động. */
    .gb-patient-card.pc-vao-chuyen-khoa .pc-header {
        background: #4a697f !important;
        color: #fff !important;
    }

    .gb-patient-card.pc-vao-chuyen-vien .pc-header {
        background: #3a737f !important;
        color: #fff !important;
    }

    .gb-patient-card.pc-vao-xin-ve .pc-header {
        background: #6e5d67 !important;
        color: #fff !important;
    }

    .pc-body p,
    .pc-section-box p {
        font-size: 17px !important;
        line-height: 1.5;
    }

    .pc-other-note {
        font-size: 16px !important;
    }

    .two-col {
        flex-direction: column !important;
        gap: 10px;
    }

    .two-col > div {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    .two-col > div:first-child::after {
        display: none;
    }

    .gb-editor-two-cols {
        flex-wrap: wrap;
    }

    .gb-editor-two-cols > .gb-editor-col {
        flex: 1 1 100%;
    }

    .gb-locmau-card,
    .gb-note-card {
        margin: 8px 0;
        padding: 14px 16px;
        border: 1px solid var(--gb-mobile-line);
        border-radius: 12px;
        background: #fff;
    }

    .gb-locmau-card .pc-section-box {
        margin-bottom: 4px;
    }

    .gb-locmau-card .locmau-line,
    .gb-note-card .note-line {
        margin-bottom: 8px;
    }

    .gb-locmau-card .locmau-value,
    .gb-note-card .note-value {
        font-size: 15pt;
        white-space: pre-line;
    }

    .gb-locmau-card .label-green,
    .pc-canthiep .label-green {
        color: var(--gb-mobile-teal);
        font-weight: 700;
    }

    .pc-canthiep {
        background: #f0f6f6;
    }

    .pc-canthiep .pc-header {
        color: #fff;
        background: #315f77;
    }

    .pc-canthiep .pc-room {
        color: #d9edef;
    }

    .gb-note-card .pc-title {
        font-size: 15pt;
        font-weight: 700;
    }

    .gb-report-table-render table {
        min-width: 520px;
        font-size: 13px;
    }

    .gb-report-table-render th,
    .gb-report-table-render td {
        padding: 7px 6px;
    }
}

@media screen and (max-width: 768px) {
    .gb-report-full .pc-header .tuoi {
        display: inline-flex;
        align-items: center;
        padding: 2px 7px;
        border: 1px solid transparent;
        border-radius: 999px;
        line-height: 1.2;
        text-shadow: none;
    }

    .gb-report-full .pc-header .tuoi.male {
        border-color: #93c5fd !important;
        background: #dbeafe !important;
        color: #1e3a8a !important;
    }

    .gb-report-full .pc-header .tuoi.female {
        border-color: #f9a8d4 !important;
        background: #fce7f3 !important;
        color: #9d174d !important;
    }

    .gb-mobile-lab-view {
        width: 100%;
    }

    .gb-mobile-lab-heading {
        margin: 0 0 8px;
        font-weight: 750;
    }

    .gb-mobile-lab-list {
        display: block;
    }

    .gb-mobile-lab-group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .gb-mobile-lab-group.is-single-column {
        grid-template-columns: minmax(0, 1fr);
    }

    .gb-mobile-lab-column {
        display: grid;
        align-content: start;
        gap: 6px;
    }

    .gb-mobile-lab-item {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: baseline;
        column-gap: 8px;
        padding: 8px 10px;
        border: 1px solid #d8e2e5;
        border-radius: 8px;
        background: #fff;
    }

    .gb-mobile-lab-name {
        min-width: 0;
        color: #24414d;
        font-size: 15px !important;
        font-weight: 650 !important;
        line-height: 1.3 !important;
        overflow-wrap: anywhere;
    }

    .gb-mobile-lab-result {
        min-width: 0;
        padding-left: 0;
        border-left: 0;
        color: #102f3b;
        font-size: 16px !important;
        font-weight: 700;
        text-align: right;
        overflow-wrap: anywhere;
    }

    .gb-mobile-lab-item.is-imaging {
        display: block;
        margin-top: 6px;
        padding: 10px;
    }

    .gb-mobile-lab-item.is-imaging .gb-mobile-lab-name {
        display: block;
        margin-bottom: 4px;
        color: #24414d !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        line-height: 1.4 !important;
    }

    .gb-mobile-lab-item.is-imaging .gb-mobile-lab-result {
        display: block;
        padding-left: 0;
        border-left: 0;
        font-weight: 500;
        line-height: 1.45;
        text-align: left;
    }
}

@media screen and (max-width: 420px) {
    .gb-mobile-lab-group {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media screen and (max-width: 520px) {
    .gb-grid-row {
        grid-template-columns: 1fr !important;
    }
}
