:root {
    --aqm-bg: #020617;
    --aqm-card: rgba(15, 23, 42, 0.92);
    --aqm-card-2: rgba(30, 41, 59, 0.72);
    --aqm-border: rgba(148, 163, 184, 0.22);
    --aqm-border-strong: rgba(96, 165, 250, 0.38);
    --aqm-text: #e5e7eb;
    --aqm-muted: #94a3b8;
    --aqm-blue: #2563eb;
    --aqm-cyan: #06b6d4;
    --aqm-green: #16a34a;
    --aqm-orange: #f97316;
    --aqm-red: #ef4444;
    --aqm-shadow: 0 35px 120px rgba(0, 0, 0, 0.72);
}

/* Add Question main button */
.addQuestionBtn {
    background: linear-gradient(135deg, #16a34a, #22c55e) !important;
    color: #fff !important;
    border: 1px solid rgba(134, 239, 172, 0.45) !important;
    box-shadow: 0 12px 28px rgba(22, 163, 74, 0.35);
}

/* Backdrop */
.aqmBackdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px;

    background:
        radial-gradient(circle at 20% 15%, rgba(37, 99, 235, 0.28), transparent 32%),
        radial-gradient(circle at 80% 25%, rgba(6, 182, 212, 0.20), transparent 28%),
        radial-gradient(circle at 50% 90%, rgba(22, 163, 74, 0.18), transparent 28%),
        rgba(2, 6, 23, 0.86);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.aqmBackdrop.show {
    display: flex;
    animation: aqmFadeIn 0.22s ease-out;
}

/* Modal */
.aqmModal {
    width: min(1460px, 98vw);
    height: min(95vh, 940px);
    position: relative;

    background:
        linear-gradient(145deg, rgba(15, 23, 42, 0.97), rgba(2, 6, 23, 0.99)),
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 35%);

    color: var(--aqm-text);
    border: 1px solid var(--aqm-border-strong);
    border-radius: 26px;
    box-shadow: var(--aqm-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: aqmPop 0.24s ease-out forwards;
}

.aqmModal::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent),
        radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.25), transparent 32%);
    opacity: 0.8;
}

.aqmHeader,
.aqmWorkspace,
.aqmStatus,
.aqmGrid,
.aqmStats {
    position: relative;
    z-index: 2;
}

/* Header */
.aqmHeader {
    flex-shrink: 0;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.50));
}

.aqmHeader h2 {
    margin: 0;
    font-size: clamp(20px, 2vw, 26px);
    line-height: 1.15;
    letter-spacing: -0.04em;
    color: #fff;
    font-weight: 950;
}

.aqmHeader p {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--aqm-muted);
}

.aqmCloseBtn {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    background: rgba(30, 41, 59, 0.82);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transition: 0.18s ease;
}

.aqmCloseBtn:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
    transform: rotate(6deg) scale(1.04);
}

/* Old removed rows hidden */
.aqmApiRow,
.aqmJsonFull {
    display: none !important;
}

/* Main Workspace: left actions, right work area */
.aqmWorkspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(190px, 17%) 1fr;
    gap: 14px;
    padding: 14px 18px 18px;
    overflow: hidden;
}

/* Left Action Panel */
.aqmSidePanel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 35%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(2, 6, 23, 0.60));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 18px 50px rgba(0, 0, 0, 0.22);
}

.aqmSideTitle {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.aqmSideTitle span {
    color: #fff;
    font-size: 16px;
    font-weight: 950;
    letter-spacing: -0.03em;
}

.aqmSideTitle small {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.35;
}

/* Actions */
.aqmActionRow {
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.aqmSideActions {
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
}

.aqmActionRow button,
.aqmMiniBtn {
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
    padding: 11px 15px;
    cursor: pointer;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
    transition: 0.18s ease;
}

.aqmSideActions button {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px !important;
    border-radius: 14px !important;
    font-size: 14px;
    line-height: 1.15;
    white-space: normal;
    text-align: center;
}

.aqmActionRow button.green,
.aqmMiniBtn.green {
    background: linear-gradient(135deg, #059669, #16a34a);
    box-shadow: 0 12px 28px rgba(5, 150, 105, 0.24);
}

.aqmActionRow button.orange,
.aqmMiniBtn.orange {
    background: linear-gradient(135deg, #ea580c, #f97316);
    box-shadow: 0 12px 28px rgba(234, 88, 12, 0.24);
}

.aqmActionRow button.gray,
.aqmMiniBtn.gray {
    background: linear-gradient(135deg, #475569, #334155);
    box-shadow: 0 12px 28px rgba(71, 85, 105, 0.24);
}

.aqmActionRow button.red,
.aqmMiniBtn.danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 12px 28px rgba(220, 38, 38, 0.24);
}

.aqmMiniBtn.restore {
    background: linear-gradient(135deg, #16a34a, #22c55e) !important;
}

.aqmActionRow button:hover,
.aqmMiniBtn:hover {
    opacity: 0.96;
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.aqmActionRow button:active,
.aqmMiniBtn:active {
    transform: translateY(0) scale(0.98);
}

.aqmActionRow button:disabled,
.aqmMiniBtn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

/* Stats in side panel */
.aqmStats {
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.aqmSidePanel .aqmStats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.aqmStat {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.74));
    border: 1px solid rgba(148, 163, 184, 0.18);
    padding: 8px 12px;
    border-radius: 999px;
    color: #dbeafe;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.25;
}

.aqmSidePanel .aqmStat {
    width: 100%;
    border-radius: 14px;
    padding: 9px 10px;
    font-size: 12px;
}

.aqmStat.good {
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.38);
}

.aqmStat.bad {
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.38);
}


/* Status */
.aqmStatus {
    margin: 0;
    padding: 12px;
    min-height: 78px;
    max-height: none;
    flex: 1;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(2, 6, 23, 0.92), rgba(6, 78, 59, 0.22));
    border: 1px solid rgba(34, 197, 94, 0.42);
    color: #bbf7d0;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.45;
    overflow: auto;
}

/* Right Main Panel */
.aqmMainPanel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.aqmGrid {
    padding: 0;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(360px, 0.92fr) minmax(460px, 1.08fr);
    gap: 14px;
}

/* Box */
.aqmBox {
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.62), rgba(2, 6, 23, 0.42));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 16px 50px rgba(0, 0, 0, 0.18);
}

.aqmApiRow label,
.aqmBox label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: #cbd5e1;
    font-weight: 850;
    text-transform: uppercase;
}

.aqmApiRow label::before,
.aqmBox label::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--aqm-cyan), var(--aqm-blue));
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.8);
}

/* Textarea */
.aqmBox textarea {
    width: 100%;
    flex: 1;
    min-height: 0;
    height: 100%;
    resize: none;
    line-height: 1.55;
    white-space: pre;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13.5px;

    border: 1px solid rgba(148, 163, 184, 0.24);
    outline: none;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(2, 6, 23, 0.92), rgba(15, 23, 42, 0.86));
    color: #e5e7eb;
    padding: 13px 14px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 10px 30px rgba(0, 0, 0, 0.18);
    transition: 0.18s ease;
}

.aqmBox textarea::placeholder {
    color: #64748b;
}

.aqmBox textarea:focus {
    border-color: rgba(96, 165, 250, 0.75);
    box-shadow:
        0 0 0 4px rgba(37, 99, 235, 0.18),
        0 16px 40px rgba(0, 0, 0, 0.28);
}

.aqmPasteBox,
.aqmPreviewBox {
    min-height: 0;
    height: 100%;
}

.aqmPasteBox textarea {
    min-height: 0 !important;
    height: 100%;
}

/* Preview Box */
.aqmPreviewBox {
    overflow: hidden;
}

.aqmPreviewTop {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.aqmPreviewMiniStats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #93c5fd;
    font-size: 12px;
    font-weight: 900;
}

.aqmPreviewMiniStats span {
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.aqmPreviewNav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.aqmMiniBtn {
    padding: 8px 10px !important;
    border-radius: 11px !important;
    font-size: 12px;
    min-height: 34px;
    box-shadow: none;
}

.aqmPreviewBody {
    flex: 1;
    min-height: 0 !important;
    height: 100%;
    overflow: auto;
    padding-right: 4px;
}

/* Empty Preview */
.aqmPreviewEmpty {
    height: 100%;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
    color: #94a3b8;
    border: 1px dashed rgba(148, 163, 184, 0.25);
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.38);
    padding: 22px;
}

.aqmPreviewEmptyIcon {
    font-size: 42px;
    margin-bottom: 8px;
}

.aqmPreviewEmpty h3 {
    margin: 0 0 6px;
    color: #e5e7eb;
}

.aqmPreviewEmpty p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

/* Preview Card */
.aqmPreviewCard {
    min-height: 100%;
    border: 1px solid rgba(96, 165, 250, 0.26);
    border-radius: 18px;
    padding: 16px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.15), transparent 30%),
        rgba(2, 6, 23, 0.55);
}

.aqmPreviewCard.isRejected {
    opacity: 0.62;
    border-color: rgba(239, 68, 68, 0.55);
    background:
        radial-gradient(circle at top left, rgba(239, 68, 68, 0.13), transparent 30%),
        rgba(2, 6, 23, 0.55);
}

.aqmQMeta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.aqmBadge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.16);
    border: 1px solid rgba(96, 165, 250, 0.32);
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 900;
}

.aqmBadge.accepted {
    background: rgba(22, 163, 74, 0.16);
    border-color: rgba(34, 197, 94, 0.32);
    color: #bbf7d0;
}

.aqmBadge.rejected {
    background: rgba(220, 38, 38, 0.17);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.aqmBadge.type {
    color: #e0f2fe;
}

/* Question text */
.aqmQuestionText {
    font-size: 18px;
    line-height: 1.65;
    font-weight: 850;
    color: #ffffff;
    margin-bottom: 14px;
}

/* Options */
.aqmOptionsList {
    display: grid;
    gap: 11px;
    margin-bottom: 14px;
}

.aqmOptionRow {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.62);
}

.aqmOptionRow span {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.20);
    color: #bfdbfe;
    font-weight: 950;
}

.aqmOptionRow p {
    margin: 4px 0 0;
    color: #e5e7eb;
    line-height: 1.45;
    font-size: 15px;
}

.aqmOptionRow.correct {
    border-color: rgba(34, 197, 94, 0.48);
    background: rgba(22, 163, 74, 0.12);
}

.aqmOptionRow.correct span {
    background: rgba(22, 163, 74, 0.34);
    color: #bbf7d0;
}

/* Answer and solution */
.aqmSolutionBox {
    margin-top: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.16);
    color: #dbeafe;
    line-height: 1.55;
}

.aqmSolutionBox p {
    margin: 7px 0 0;
    color: #cbd5e1;
}

/* Scrollbar */
.aqmBox textarea::-webkit-scrollbar,
.aqmStatus::-webkit-scrollbar,
.aqmPreviewBody::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.aqmBox textarea::-webkit-scrollbar-track,
.aqmStatus::-webkit-scrollbar-track,
.aqmPreviewBody::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
}

.aqmBox textarea::-webkit-scrollbar-thumb,
.aqmStatus::-webkit-scrollbar-thumb,
.aqmPreviewBody::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #334155, #64748b);
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 42, 0.9);
}

.aqmBox textarea::-webkit-scrollbar-thumb:hover,
.aqmStatus::-webkit-scrollbar-thumb:hover,
.aqmPreviewBody::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #475569, #94a3b8);
}

/* Firefox scrollbar */
.aqmBox textarea,
.aqmStatus,
.aqmPreviewBody {
    scrollbar-width: thin;
    scrollbar-color: #64748b rgba(15, 23, 42, 0.9);
}

/* Animations */
@keyframes aqmFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes aqmPop {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive */
@media (max-width: 1100px) {
    .aqmBackdrop {
        padding: 10px;
    }

    .aqmModal {
        width: 100%;
        height: 96vh;
        border-radius: 22px;
    }

    .aqmWorkspace {
        grid-template-columns: 210px 1fr;
        gap: 12px;
        padding: 12px;
    }

    .aqmMainPanel .aqmGrid,
    .aqmGrid {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .aqmPasteBox textarea {
        min-height: 300px !important;
    }

    .aqmPreviewBody {
        min-height: 380px !important;
    }
}

@media (max-width: 760px) {
    .aqmWorkspace {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .aqmSidePanel {
        order: 2;
    }

    .aqmMainPanel {
        order: 1;
    }

    .aqmSideActions {
        grid-template-columns: 1fr 1fr !important;
    }

    .aqmSidePanel .aqmStats {
        grid-template-columns: 1fr 1fr;
    }

    .aqmSidePanel .aqmStatus {
        max-height: 130px;
        flex: unset;
    }

    .aqmHeader {
        align-items: flex-start;
    }

    .aqmCloseBtn {
        width: 40px;
        height: 40px;
    }

    .aqmPreviewTop {
        flex-direction: column;
    }

    .aqmPreviewNav {
        justify-content: flex-start;
    }

    .aqmMiniBtn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .aqmSideActions {
        grid-template-columns: 1fr !important;
    }

    .aqmSidePanel .aqmStats {
        grid-template-columns: 1fr;
    }

    .aqmQuestionText {
        font-size: 16px;
    }

    .aqmOptionRow {
        grid-template-columns: 34px 1fr;
        padding: 10px;
    }

    .aqmOptionRow p {
        font-size: 14px;
    }
}


/* =====================================================
   Paste box inside action panel + right full preview
   ===================================================== */

.aqmWorkspace {
    grid-template-columns: minmax(310px, 28%) 1fr !important;
    gap: 14px !important;
    overflow: hidden !important;
}

.aqmSidePanel {
    overflow: hidden !important;
    padding: 0 !important;
}

.aqmSideScroll {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aqmSidePasteBox {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.36);
}

.aqmSidePasteBox label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: #cbd5e1;
    font-weight: 850;
    text-transform: uppercase;
}

.aqmSidePasteBox label::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--aqm-cyan), var(--aqm-blue));
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.8);
}

.aqmSidePasteBox textarea {
    width: 100%;
    min-height: 230px;
    max-height: 320px;
    resize: vertical;
    overflow: auto;
    line-height: 1.55;
    white-space: pre;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px;

    border: 1px solid rgba(148, 163, 184, 0.24);
    outline: none;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.95), rgba(15, 23, 42, 0.86));
    color: #e5e7eb;
    padding: 12px;
}

.aqmSidePasteBox textarea:focus {
    border-color: rgba(96, 165, 250, 0.75);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.aqmMainPanel {
    min-height: 0 !important;
    height: 100% !important;
}

.aqmFullPreviewBox {
    height: 100%;
    min-height: 0;
}

.aqmPreviewBody {
    flex: 1;
    min-height: 0 !important;
    height: 100%;
}

.aqmPreviewCard {
    min-height: 100%;
}

.aqmSideActions {
    grid-template-columns: 1fr 1fr !important;
}

.aqmSideActions button:first-child,
.aqmSideActions button:nth-child(2) {
    grid-column: span 2;
}

.aqmSidePanel .aqmStats {
    grid-template-columns: 1fr 1fr !important;
}

.aqmSidePanel .aqmStatus {
    flex: unset !important;
    min-height: 90px !important;
    max-height: 180px !important;
}

.aqmGrid,
.aqmPasteBox {
    display: none !important;
}

/* Scrollbar for left panel and paste box */
.aqmSideScroll::-webkit-scrollbar,
.aqmSidePasteBox textarea::-webkit-scrollbar {
    width: 10px;
}

.aqmSideScroll::-webkit-scrollbar-track,
.aqmSidePasteBox textarea::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
}

.aqmSideScroll::-webkit-scrollbar-thumb,
.aqmSidePasteBox textarea::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #334155, #64748b);
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 42, 0.9);
}

@media (max-width: 1100px) {
    .aqmWorkspace {
        grid-template-columns: minmax(280px, 34%) 1fr !important;
    }

    .aqmSidePasteBox textarea {
        min-height: 210px;
    }
}

@media (max-width: 760px) {
    .aqmWorkspace {
        grid-template-columns: 1fr !important;
        overflow: auto !important;
    }

    .aqmSidePanel {
        order: 1 !important;
        min-height: 520px;
    }

    .aqmMainPanel {
        order: 2 !important;
        min-height: 520px;
    }

    .aqmSideActions {
        grid-template-columns: 1fr 1fr !important;
    }
}


/* Preview options: 2 options in one row */
.aqmPreviewBox .aqmOptionsList {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
}

.aqmPreviewBox .aqmOptionRow {
    min-width: 0;
    height: 100%;
}

.aqmPreviewBox .aqmOptionRow p {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Mobile par 1 option per row */
@media (max-width: 760px) {
    .aqmPreviewBox .aqmOptionsList {
        grid-template-columns: 1fr !important;
    }
}


/* Send to DB + Clear same row */
.aqmSideActions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
}

.aqmSideActions button {
    grid-column: auto !important;
    width: 100% !important;
}

/* Convert full width */
#aqmConvertBtn {
    grid-column: 1 / -1 !important;
    order: 1;
}

/* Send + Clear in same row */
#aqmSendApiBtn {
    grid-column: auto !important;
    order: 2;
}

#aqmClearBtn {
    grid-column: auto !important;
    order: 3;
}

/* Copy + CSV next row */
#aqmCopyJsonBtn {
    grid-column: auto !important;
    order: 4;
}

#aqmDownloadCsvBtn {
    grid-column: auto !important;
    order: 5;
}

.aqmHtmlRender {
    color: inherit;
}

.aqmHtmlRender p {
    margin: 6px 0;
}

.aqmHtmlRender b,
.aqmHtmlRender strong {
    color: #ffffff;
    font-weight: 900;
}

.aqmHtmlRender ul,
.aqmHtmlRender ol {
    margin: 8px 0 8px 22px;
    padding: 0;
}

.aqmHtmlRender li {
    margin: 4px 0;
}

.aqmHtmlRender table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.aqmHtmlRender th,
.aqmHtmlRender td {
    border: 1px solid rgba(148, 163, 184, 0.28);
    padding: 8px;
    text-align: left;
}

.aqmHtmlRender img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.aqmHtmlRender code {
    padding: 2px 6px;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.9);
    color: #fde68a;
}

/* =====================================================
   HTML/Math preview fix: subscript, superscript, formulas
   ===================================================== */
.aqmHtmlRender sub {
    vertical-align: sub;
    font-size: 70%;
    line-height: 0;
}

.aqmHtmlRender sup {
    vertical-align: super;
    font-size: 70%;
    line-height: 0;
}

.aqmHtmlRender strong,
.aqmHtmlRender b {
    font-weight: 900;
    color: inherit;
}

.aqmHtmlRender br {
    display: block;
    content: "";
    margin-top: 3px;
}

.aqmHtmlRender table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    overflow: hidden;
    border-radius: 12px;
}

.aqmHtmlRender th,
.aqmHtmlRender td {
    border: 1px solid rgba(148, 163, 184, 0.28);
    padding: 8px 10px;
    color: #e5e7eb;
    vertical-align: top;
}

.aqmHtmlRender th {
    background: rgba(37, 99, 235, 0.18);
    color: #bfdbfe;
    font-weight: 900;
}
