.mrt-tool {
    --mrt-ink: #172033;
    --mrt-muted: #667085;
    --mrt-line: #d9e2ec;
    --mrt-soft: #f4f7fb;
    --mrt-panel: #ffffff;
    --mrt-primary: #0f6fb5;
    --mrt-primary-dark: #0a4f82;
    --mrt-accent: #0d9488;
    --mrt-warn: #b7791f;
    --mrt-danger: #c2413a;
    --mrt-ok: #147d64;
    --mrt-code: #132033;
    --mrt-shadow: 0 14px 32px rgba(22, 34, 51, .08);
    color: var(--mrt-ink);
    width: 100%;
}

.mrt-tool * {
    box-sizing: border-box;
}

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

.mrt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--mrt-line);
    background: linear-gradient(135deg, rgba(15, 111, 181, .08), rgba(13, 148, 136, .08)), #fff;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
}

.mrt-tip {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #314155;
    line-height: 1.6;
}

.mrt-tip-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 26px;
    border-radius: 6px;
    background: #e8f2fb;
    color: var(--mrt-primary-dark);
    font-weight: 800;
    font-size: 13px;
}

.mrt-actions,
.mrt-inline-actions,
.mrt-step-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.mrt-actions {
    flex: 0 0 auto;
}

.mrt-btn {
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 9px 13px;
    min-height: 40px;
    cursor: pointer;
    font-weight: 800;
    transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.mrt-btn:hover {
    transform: translateY(-1px);
}

.mrt-btn-primary,
.mrt-btn-next {
    background: var(--mrt-primary);
    color: #fff;
    border-color: var(--mrt-primary);
    box-shadow: 0 8px 18px rgba(15, 111, 181, .18);
}

.mrt-btn-soft {
    background: #e7f5f3;
    color: #075f58;
    border-color: #b8ded9;
}

.mrt-btn-ghost {
    background: #fff;
    color: #1f3b57;
    border-color: var(--mrt-line);
}

.mrt-link-btn {
    border: 0;
    background: transparent;
    color: var(--mrt-primary-dark);
    padding: 0;
    font-weight: 800;
    cursor: pointer;
}

.mrt-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.mrt-tab {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    min-height: 66px;
    border: 1px solid var(--mrt-line);
    background: #fff;
    color: #122f4a;
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
}

.mrt-tab:hover,
.mrt-tab.active {
    border-color: var(--mrt-primary);
    background: #eef7fc;
    box-shadow: 0 10px 22px rgba(15, 111, 181, .12);
}

.mrt-tab-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dcecf8;
    color: var(--mrt-primary-dark);
    font-weight: 900;
}

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

.mrt-tab b {
    display: block;
    color: #0f2b46;
    font-size: 15px;
}

.mrt-tab small {
    display: block;
    color: var(--mrt-muted);
    font-size: 12px;
    margin-top: 2px;
}

.mrt-panels {
    display: block;
}

.mrt-panel {
    display: none;
    border: 1px solid var(--mrt-line);
    border-radius: 8px;
    background: var(--mrt-panel);
    box-shadow: var(--mrt-shadow);
    padding: 18px;
}

.mrt-panel.active {
    display: block;
}

.mrt-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px solid #edf1f6;
}

.mrt-panel-head h3 {
    margin: 0 0 6px;
    font-size: 18px;
    line-height: 1.35;
}

.mrt-panel-head p {
    margin: 0;
    color: var(--mrt-muted);
    line-height: 1.6;
    font-size: 13px;
}

.mrt-mode {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    gap: 6px;
    padding: 5px;
    margin: 16px 0;
    border: 1px solid var(--mrt-line);
    background: var(--mrt-soft);
    border-radius: 8px;
}

.mrt-mode button {
    border: 0;
    border-radius: 6px;
    padding: 9px 12px;
    background: transparent;
    color: #1f3b57;
    cursor: pointer;
    font-weight: 800;
}

.mrt-mode button.active {
    background: #fff;
    color: var(--mrt-primary-dark);
    box-shadow: 0 6px 14px rgba(22, 34, 51, .10);
}

.mrt-mode-panel {
    display: none;
}

.mrt-mode-panel.active {
    display: block;
}

.mrt-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr);
    gap: 16px;
    align-items: start;
}

.mrt-form,
.mrt-output {
    border: 1px solid #e2e9f2;
    background: #fff;
    border-radius: 8px;
    padding: 16px;
}

.mrt-form {
    display: grid;
    gap: 14px;
}

.mrt-grid {
    display: grid;
    gap: 12px;
}

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

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

.mrt-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mrt-field {
    display: grid;
    gap: 7px;
}

.mrt-field span {
    font-weight: 800;
    font-size: 13px;
    color: #24364c;
}

.mrt-field small {
    color: var(--mrt-muted);
    font-size: 12px;
    line-height: 1.5;
}

.mrt-field input,
.mrt-field select,
.mrt-field textarea,
.mrt-rule input,
.mrt-rule select {
    width: 100%;
    border: 1px solid #cfd9e6;
    border-radius: 7px;
    background: #fff;
    color: var(--mrt-ink);
    padding: 10px 11px;
    outline: none;
}

.mrt-field textarea {
    min-height: 88px;
    resize: vertical;
    font-family: Consolas, Monaco, "Courier New", monospace;
}

.mrt-field input:focus,
.mrt-field select:focus,
.mrt-field textarea:focus,
.mrt-rule input:focus,
.mrt-rule select:focus {
    border-color: var(--mrt-primary);
    box-shadow: 0 0 0 3px rgba(15, 111, 181, .13);
}

.mrt-output {
    min-height: 240px;
}

.mrt-output-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.mrt-output-title.mt {
    margin-top: 16px;
}

.mrt-output-title b {
    font-size: 15px;
}

.mrt-output-title span {
    color: var(--mrt-muted);
    font-size: 12px;
}

.mrt-code {
    min-height: 62px;
    border-radius: 8px;
    background: var(--mrt-code);
    color: #dbeafe;
    padding: 14px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    line-height: 1.7;
    word-break: break-word;
    white-space: pre-wrap;
}

.mrt-code.is-error {
    color: #fecaca;
}

.mrt-detail {
    margin-top: 12px;
    color: #314155;
    line-height: 1.6;
    font-size: 13px;
}

.mrt-kv {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.mrt-kv div,
.mrt-note,
.mrt-segment-line {
    border: 1px solid #e5ebf3;
    background: #fbfcff;
    border-radius: 7px;
    padding: 9px 10px;
}

.mrt-kv b {
    color: #1f3b57;
}

.mrt-note {
    margin-top: 10px;
}

.mrt-note.ok {
    border-color: #b9e2d9;
    background: #effaf7;
    color: #0b6b58;
}

.mrt-note.warn {
    border-color: #f3d39b;
    background: #fff8e8;
    color: #8a5a11;
}

.mrt-note.danger {
    border-color: #f0b8b4;
    background: #fff1f1;
    color: #a8322d;
}

.mrt-segments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.mrt-byte {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 45px;
    border: 1px solid #d7e1ed;
    background: #f8fbff;
    border-radius: 6px;
    padding: 6px 7px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    text-align: center;
}

.mrt-byte b {
    color: #0f2b46;
    font-size: 13px;
}

.mrt-byte small {
    color: var(--mrt-muted);
    font-family: inherit;
    font-size: 10px;
}

.mrt-batch-list {
    display: grid;
    gap: 8px;
    max-height: 420px;
    overflow: auto;
}

.mrt-batch-item {
    border: 1px solid #e2e9f2;
    border-left: 4px solid var(--mrt-ok);
    background: #fbfcff;
    border-radius: 7px;
    padding: 9px 10px;
    font-size: 13px;
}

.mrt-batch-item.error {
    border-left-color: var(--mrt-danger);
    background: #fff6f6;
}

.mrt-batch-item code {
    display: block;
    margin-top: 4px;
    color: #122f4a;
    font-family: Consolas, Monaco, "Courier New", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.mrt-step-nav {
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #edf1f6;
    color: var(--mrt-muted);
}

.mrt-rule-box {
    border: 1px solid #e2e9f2;
    border-radius: 8px;
    padding: 12px;
    background: #fbfcff;
}

.mrt-rule-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.mrt-rules {
    display: grid;
    gap: 8px;
}

.mrt-rule,
.mrt-rule-labels {
    display: grid;
    grid-template-columns: 1.2fr .7fr 1fr 1fr .7fr 36px;
    gap: 8px;
    align-items: center;
}

.mrt-rule-labels {
    color: var(--mrt-muted);
    font-size: 12px;
    margin-top: 8px;
    padding: 0 2px;
}

.mrt-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #f0b8b4;
    border-radius: 7px;
    background: #fff6f6;
    color: var(--mrt-danger);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.mrt-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

.mrt-table th,
.mrt-table td {
    border: 1px solid #dde5ef;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.mrt-table th {
    background: #f2f6fb;
    color: #1f3b57;
}

.mrt-split-line {
    border-top: 1px solid #edf1f6;
}

.mrt-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9999;
    background: #0f6b5f;
    color: #fff;
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 12px 28px rgba(22, 34, 51, .18);
    font-weight: 800;
}

.mrt-hidden {
    display: none !important;
}

@media (max-width: 992px) {
    .mrt-workspace,
    .mrt-grid.four,
    .mrt-grid.three {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .mrt-topbar,
    .mrt-panel-head,
    .mrt-step-nav {
        align-items: stretch;
        flex-direction: column;
    }

    .mrt-tabs {
        grid-template-columns: 1fr 1fr;
    }

    .mrt-workspace,
    .mrt-grid.two,
    .mrt-grid.three,
    .mrt-grid.four,
    .mrt-kv {
        grid-template-columns: 1fr;
    }

    .mrt-rule,
    .mrt-rule-labels {
        grid-template-columns: 1fr;
    }

    .mrt-rule-labels {
        display: none;
    }
}
