#olap-builder {
    margin-top: 24px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    font-family: Arial, sans-serif;
    color: #111827;
}

#olap-builder h2 {
    margin: 0 0 8px;
    font-size: 26px;
}

#olap-builder h3 {
    margin: 18px 0 10px;
    font-size: 15px;
}

.olap-description {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 18px;
}

.olap-toolbar {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 14px;
    border-radius: 10px;
}

.olap-toolbar label {
    flex: 1;
    min-width: 260px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    color: #475569;
}

.olap-toolbar input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 11px 14px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
}

.olap-toolbar button,
.olap-filter-editor button {
    border: 1px solid #d7dfeb;
    background: #fff;
    border-radius: 10px;
    padding: 11px 14px;
    cursor: pointer;
    font-weight: 600;
}

.olap-toolbar button:hover,
.olap-filter-editor button:hover {
    background: #f1f5f9;
}

.olap-status {
    margin: 0 -20px 18px;
    padding: 12px 20px;
    background: #f8fafc;
    color: #475569;
    font-size: 14px;
}

.olap-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.olap-panel {
    padding: 16px;
    min-width: 0;
}

.olap-panel:first-child {
    border-right: 1px solid #e2e8f0;
}

.olap-fields {
    height: 520px;
    overflow: auto;
    padding-right: 5px;
}

.olap-field {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 7px;
    cursor: grab;
}

.olap-field:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.olap-field:active {
    cursor: grabbing;
}

.olap-field strong,
.olap-selected-field strong {
    display: block;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.olap-field small,
.olap-selected-field small {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 11px;
}

.olap-flags {
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
    margin-left: 8px;
}

.olap-selected {
    min-height: 72px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 8px;
    background: #f8fafc;
    transition: 0.15s;
}

.olap-selected.olap-drop-active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: inset 0 0 0 2px #bfdbfe;
}

.olap-selected-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 9px;
    padding: 9px 10px;
    margin-bottom: 6px;
    cursor: grab;
}

.olap-selected-field:last-child {
    margin-bottom: 0;
}

.olap-selected-field button,
.olap-filter-item button {
    border: 0;
    background: transparent;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 3px 7px;
}

.olap-selected-field button:hover,
.olap-filter-item button:hover {
    color: #dc2626;
}

.olap-empty {
    text-align: center;
    color: #94a3b8;
    padding: 22px 10px;
    font-size: 13px;
}

.olap-filters-panel {
    margin-top: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
}

.olap-filter-editor {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.4fr auto;
    gap: 10px;
    align-items: end;
}

.olap-filter-editor label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.olap-filter-editor input,
.olap-filter-editor select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 10px;
    border: 1px solid #dbe3ee;
    border-radius: 9px;
    background: #fff;
}

.olap-filters-list {
    margin-top: 12px;
}

.olap-filter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #f8fafc;
    margin-top: 7px;
}

.olap-filter-item small {
    display: block;
    color: #64748b;
    margin-top: 3px;
}

.olap-period {
    margin-top: 18px;
}

.olap-period > div {
    display: flex;
    gap: 12px;
}

.olap-period label {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.olap-period input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 10px;
    border: 1px solid #dbe3ee;
    border-radius: 9px;
}

#olap-run {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    border: 0;
    border-radius: 10px;
    background: #111827;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

#olap-run:hover {
    background: #1f2937;
}

.olap-result {
    margin-top: 20px;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.report-table-wrapper {
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.report-table th,
.report-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
}

.report-table th {
    background: #f8fafc;
    font-weight: 700;
}

.report-table tbody tr:hover td {
    background: #f8fafc;
}

.report-loading {
    padding: 14px;
    color: #475569;
}

.report-error {
    padding: 14px;
    border-radius: 9px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.olap-result pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    overflow: auto;
    font-size: 12px;
    white-space: pre-wrap;
}

@media (max-width: 850px) {

    .olap-grid {
        grid-template-columns: 1fr;
    }

    .olap-panel:first-child {
        border-right: 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .olap-fields {
        height: 360px;
    }

    .olap-filter-editor {
        grid-template-columns: 1fr;
    }

    .olap-period > div {
        flex-direction: column;
    }
}
