.radar-tool {
    --radar-primary: #1769c2;
    --radar-primary-strong: #0f4f96;
    --radar-accent: #0f766e;
    --radar-warm: #b45309;
    --radar-danger: #c2410c;
    --radar-ink: #172033;
    --radar-muted: #667085;
    --radar-border: #d9e1ec;
    --radar-soft: #f5f8fb;
    --radar-panel: #ffffff;
    --radar-shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
    color: var(--radar-ink);
    width: 100%;
}

.radar-tool * {
    box-sizing: border-box;
    letter-spacing: 0;
}

.radar-tool button,
.radar-tool input,
.radar-tool select {
    font: inherit;
}

.radar-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 14px;
    margin-bottom: 16px;
    border: 1px solid #c7d9ee;
    border-radius: 8px;
    background: #f2f7fd;
    color: #244b76;
    font-size: 13px;
}

.radar-alert-dot {
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--radar-primary);
    box-shadow: 0 0 0 4px rgba(23, 105, 194, 0.12);
}

.radar-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 6px;
    margin-bottom: 18px;
    border: 1px solid var(--radar-border);
    border-radius: 8px;
    background: #eef3f8;
}

.radar-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 10px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #31445c;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.radar-tab:hover {
    background: rgba(255, 255, 255, 0.72);
    color: var(--radar-primary-strong);
}

.radar-tab.active {
    background: #fff;
    color: var(--radar-primary-strong);
    box-shadow: 0 8px 18px rgba(23, 32, 51, 0.1);
    font-weight: 700;
}

.tab-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(23, 105, 194, 0.12);
    color: var(--radar-primary-strong);
    font-size: 12px;
    font-weight: 800;
}

.radar-tab.active .tab-index {
    background: var(--radar-primary);
    color: #fff;
}

.tab-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.radar-tab-panel[hidden] {
    display: none;
}

.radar-panel-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.radar-panel-grid.two-col {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.radar-section,
.radar-preview-card {
    border: 1px solid var(--radar-border);
    border-radius: 8px;
    background: var(--radar-panel);
    box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
}

.radar-section {
    padding: 18px;
}

.radar-section.compact {
    padding: 14px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.section-heading.small {
    margin-bottom: 12px;
}

.section-heading h3 {
    margin: 0;
    color: var(--radar-ink);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
}

.section-heading.small h3 {
    font-size: 14px;
}

.section-heading p {
    margin: 3px 0 0;
    color: var(--radar-muted);
    font-size: 12px;
    line-height: 1.5;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--radar-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.radar-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.radar-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: #344154;
    font-size: 12px;
    font-weight: 700;
}

.radar-field.full {
    grid-column: 1 / -1;
}

.radar-field input,
.radar-field select,
.radar-compare-controls select {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cfd8e5;
    border-radius: 7px;
    background: #fff;
    color: var(--radar-ink);
    padding: 8px 10px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.radar-field input:focus,
.radar-field select:focus,
.radar-compare-controls select:focus {
    border-color: var(--radar-primary);
    box-shadow: 0 0 0 3px rgba(23, 105, 194, 0.12);
}

.radar-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.radar-checks label {
    display: flex;
    align-items: center;
    min-height: 34px;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid #e1e7ef;
    border-radius: 7px;
    background: var(--radar-soft);
    color: #344154;
    font-size: 13px;
    cursor: pointer;
}

.radar-checks input,
.radar-tool input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--radar-primary);
}

.radar-actions,
.radar-export-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.radar-export-toolbar {
    align-items: center;
}

.radar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #fff;
    color: #344154;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.radar-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.radar-btn:disabled {
    opacity: .48;
    cursor: not-allowed;
}

.radar-btn.primary {
    border-color: var(--radar-primary);
    background: var(--radar-primary);
    color: #fff;
    box-shadow: 0 10px 20px rgba(23, 105, 194, 0.18);
}

.radar-btn.primary:hover:not(:disabled) {
    background: var(--radar-primary-strong);
}

.radar-btn.outline {
    border-color: #cfd8e5;
    color: var(--radar-primary-strong);
}

.radar-btn.outline:hover:not(:disabled) {
    border-color: var(--radar-primary);
    background: #f3f8ff;
}

.radar-btn.ghost {
    border-color: transparent;
    background: #eef3f8;
}

.radar-btn.ghost:hover:not(:disabled) {
    background: #e1eaf4;
}

.radar-btn.accent {
    border-color: var(--radar-accent);
    background: var(--radar-accent);
    color: #fff;
}

.radar-btn.large {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 14px;
}

.radar-step-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid var(--radar-border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--radar-muted);
    font-size: 13px;
}

.radar-import-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.radar-upload {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 132px;
    gap: 7px;
    padding: 16px;
    border: 1.5px dashed #b8c7d9;
    border-radius: 8px;
    background: #f8fbfe;
    color: var(--radar-ink);
    cursor: pointer;
}

.radar-upload:hover {
    border-color: var(--radar-primary);
    background: #f3f8ff;
}

.radar-upload input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    background: #dfeefa;
    color: var(--radar-primary-strong);
    font-size: 12px;
    font-weight: 900;
}

.radar-upload small {
    color: var(--radar-muted);
    font-size: 12px;
    line-height: 1.45;
}

.radar-file-list {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #d7e1ed;
    border-radius: 8px;
    background: #fbfcfe;
    color: var(--radar-muted);
    font-size: 12px;
}

.radar-file-list strong {
    color: var(--radar-ink);
}

.radar-file-list ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.dimension-list,
.group-list {
    display: grid;
    gap: 10px;
}

.dimension-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.dimension-row .dimension-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 38px;
    border-radius: 7px;
    background: #eef3f8;
    color: var(--radar-primary-strong);
    font-weight: 800;
    font-size: 12px;
}

.dimension-row input,
.group-name-input,
.group-value-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid #cfd8e5;
    border-radius: 7px;
    padding: 8px 10px;
    outline: none;
}

.dimension-row input:focus,
.group-name-input:focus,
.group-value-input:focus {
    border-color: var(--radar-primary);
    box-shadow: 0 0 0 3px rgba(23, 105, 194, 0.1);
}

.mini-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #d7e1ed;
    border-radius: 7px;
    background: #fff;
    color: #42526a;
    cursor: pointer;
}

.mini-btn:hover {
    border-color: var(--radar-danger);
    color: var(--radar-danger);
}

.group-card {
    border: 1px solid #dce5ef;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.group-card-head {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 52px auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #edf1f6;
    background: #f8fafc;
}

.group-card-head input[type="color"] {
    width: 52px;
    height: 38px;
    padding: 4px;
    border: 1px solid #cfd8e5;
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
}

.group-average {
    min-width: 70px;
    color: var(--radar-muted);
    font-size: 12px;
    text-align: right;
}

.group-values {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
}

.group-value-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.group-value-field span {
    color: var(--radar-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.radar-status {
    min-height: 34px;
    margin-top: 12px;
    padding: 8px 10px;
    border-radius: 7px;
    background: #f6f8fb;
    color: var(--radar-muted);
    font-size: 13px;
}

.radar-status.success {
    background: #ecfdf5;
    color: #047857;
}

.radar-status.error {
    background: #fff1f0;
    color: #b42318;
}

.radar-status.busy {
    background: #fff7ed;
    color: #9a3412;
}

.radar-output-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
    gap: 16px;
    margin-top: 16px;
}

.radar-preview-card {
    min-width: 0;
    overflow: hidden;
}

.preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #edf1f6;
    background: #f8fafc;
}

.preview-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
}

.preview-head p {
    margin: 3px 0 0;
    color: var(--radar-muted);
    font-size: 12px;
}

.preview-tools {
    display: flex;
    gap: 8px;
}

.preview-tools button {
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid #cfd8e5;
    border-radius: 6px;
    background: #fff;
    color: #344154;
    cursor: pointer;
}

.canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 460px;
    padding: 18px;
    overflow: auto;
    background:
        linear-gradient(45deg, rgba(23, 105, 194, 0.035) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(23, 105, 194, 0.035) 25%, transparent 25%),
        #ffffff;
    background-size: 26px 26px;
}

.canvas-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid #e3eaf2;
    border-radius: 8px;
    box-shadow: var(--radar-shadow);
    transform-origin: center center;
}

.radar-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 240px;
    padding: 8px 10px;
    border-radius: 7px;
    background: rgba(23, 32, 51, .92);
    color: #fff;
    font-size: 12px;
    line-height: 1.55;
    pointer-events: none;
}

.radar-side-panel {
    display: grid;
    align-content: start;
    gap: 16px;
    min-width: 0;
}

.radar-compare-controls {
    display: grid;
    gap: 10px;
}

.compare-result {
    margin-top: 12px;
    color: var(--radar-muted);
    font-size: 12px;
}

.compare-summary {
    padding: 10px;
    border-radius: 7px;
    background: #f2f7fd;
    color: #244b76;
    line-height: 1.55;
}

.compare-table,
.preview-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid #dce5ef;
    border-radius: 8px;
    font-size: 12px;
}

.compare-table th,
.compare-table td,
.preview-table th,
.preview-table td {
    padding: 8px;
    border-bottom: 1px solid #edf1f6;
    text-align: left;
    white-space: nowrap;
}

.compare-table th,
.preview-table th {
    background: #f8fafc;
    color: #344154;
    font-weight: 800;
}

.compare-table tr:last-child td,
.preview-table tr:last-child td {
    border-bottom: 0;
}

.compare-table .highlight td {
    background: #fff7ed;
    color: #9a3412;
    font-weight: 800;
}

.data-preview {
    max-height: 360px;
    overflow: auto;
}

.preview-table {
    min-width: 520px;
}

@media (max-width: 1100px) {
    .radar-panel-grid.two-col,
    .radar-output-grid {
        grid-template-columns: 1fr;
    }

    .group-values {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .radar-tabs {
        grid-template-columns: 1fr;
    }

    .radar-form-grid,
    .radar-checks,
    .radar-import-grid {
        grid-template-columns: 1fr;
    }

    .group-card-head {
        grid-template-columns: minmax(0, 1fr) 52px;
    }

    .group-average {
        text-align: left;
    }

    .group-values {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .radar-step-footer,
    .preview-head {
        align-items: stretch;
        flex-direction: column;
    }

    .radar-step-footer .radar-btn,
    .radar-export-toolbar .radar-btn {
        width: 100%;
    }

    .canvas-wrap {
        min-height: 320px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .dimension-row {
        grid-template-columns: 30px minmax(0, 1fr) auto;
    }

    .group-values {
        grid-template-columns: 1fr;
    }

    .radar-section {
        padding: 14px;
    }
}
