/* ==== BTN SAVE DRAW === */
#view-rule-edit .btn.js-rule-save-draft {
    color: #166534;
    border-color: #22C55E;
}

#view-rule-edit .btn.js-rule-save-draft:hover:not(:disabled) {
    color: #14532D;
    border-color: #16A34A;
    background: #ECFDF3;
}

/* ==== SCROLL HIDE  === */
#view-rules .account-scroll {
    scrollbar-width: none;
}

#view-rules .account-scroll::-webkit-scrollbar {
    display: none;
}

#view-rules .sx-section {
    scrollbar-width: none;
}

#view-rules .sx-section::-webkit-scrollbar {
    display: none;
}



/* ==== RULES ==== */
#view-rules .edit-btn.rule-use {
    height: 26px;
    padding: 4px 10px;

    background: #EEF6FF;
    border-color: #BFDBFE;
    color: #1565C0;
    font-weight: 600;
}

#view-rules .edit-btn.rule-use:hover {
    background: #DBEAFE;
    border-color: #2563EB;
}

#view-rules .edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#view-rules .ai-row.is-selected {
    background: rgba(59, 130, 246, 0.02);
}

#view-rules .rules-template-card.is-selected {
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

.js-rule-preview,
.js-rule-save-draft,
.btn-compact-widt {
    min-width: 120px;
}

.js-rule-publish {
    margin-left: auto;
    min-width: 120px;
}

.rule-add-group .btn {
    min-width: 130px;
    padding: 5px 15px;
}

#view-rules .badge-trigger {
    min-width: 100px;
}

#view-rules .badge-template-trigger {
    min-width: 120px;
}


/* ==== MY RULES ==== */
.rule-menu-wrap {
    position: relative;
    display: inline-flex;
}

.rule-menu-wrap .dropdown-menu {
    position: absolute;
    top: 34px;
    right: 0;
    left: auto;
    /* 🔴 to jest klucz */
    z-index: 50;
    min-width: 140px;
}

#view-rules .rule-search-menu-wrap {
    position: relative;
}

#view-rules #rulesSearchDropdown {
    position: absolute;
    right: 0;
    top: 42px;
    min-width: 180px;
    transform: translateX(0);
}

#view-rules .rule-search-menu-wrap {
    position: relative;
}

#view-rules #rulesSearchDropdown {
    right: 0;
    left: auto;
}


/* ================= RULES — PREVIEW WIDGET ================= */
#view-rules .rule-preview-widget {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#view-rules .rule-preview-bubble {
    background: #EEF6FF;
    border: 1px solid #BFDBFE;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    color: #1e3a8a;
}

#view-rules .rule-preview-actions {
    display: flex;
    gap: 8px;
}

#view-rules .rule-preview-btn {
    background: #1565C0;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
}

#view-rules .rule-preview-btn.secondary {
    background: #f1f3f5;
    color: #374151;
}

#view-rules .rule-preview-input.error {
    border: 1px solid #ef4444;
}


#view-rules .rule-preview-input {
    width: 100%;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

#view-rules .rule-preview-input:focus {
    border-color: #BFDBFE;
}











/* ==== MY RULES ==== */
/* RULES SEARCH (LOCAL OVERRIDE) */
#view-rules .list-search {
    display: flex;
    align-items: center;
    gap: 8px;
}

#view-rules .list-search input {
    flex: 1;
    width: auto;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    outline: none;
    height: 36px;
    box-sizing: border-box;
}

#view-rules .search-more-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#view-rules .search-more-btn:hover {
    background: #f3f4f6;
}

/* RULES SEARCH ALIGN */
#view-rules .sx-card-vertical .sx-row:has(.list-search) {
    justify-content: flex-end;
}

#view-rules .sx-card-vertical .rules-panel-header:has(.list-search) {
    justify-content: space-between;
}

#view-rules .list-search {
    width: 420px;
}

#view-rules #myRulesListSearch.list-search {
    padding: 0;
    gap: 8px;
}

#view-rule-edit .rule-edit-bottom-actions {
    margin-top: auto;
    padding: 16px 0 20px;
}


/* ==== RULE EDIT ==== */
#view-rule-edit .settings-card {
    min-width: 0;
}

#view-rule-edit .context.card {
    width: 550px;
    min-width: 550px;
    max-width: 550px;
}

/* =====================================
   RULE EDIT - SCENARIO MAIN
===================================== */

#view-rule-edit .account-scroll {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#view-rule-edit .account-scroll>.sx-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
}

#view-rule-edit .system-view[data-tab="rule-scenario"].active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#view-rule-edit .rule-edit-scenario-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#view-rule-edit .rule-edit-scenario-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 16px;
    flex-shrink: 0;
}

#view-rule-edit .rule-edit-scenario-toolbar-left,
#view-rule-edit .rule-edit-scenario-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

#view-rule-edit .rule-edit-scenario-canvas-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: var(--bg-app);
    cursor: grab;
}

#view-rule-edit .rule-edit-scenario-canvas-wrap.is-dragging {
    cursor: grabbing;
}

#view-rule-edit .rule-node {
    cursor: pointer;
    user-select: none;
}




#view-rule-edit .rule-edit-scenario-canvas {
    position: relative;
    width: max-content;
    min-width: 100%;
    min-height: 100%;
    box-sizing: border-box;
    padding: 28px 32px 40px 32px;
    display: block;
    background: var(--bg-app);
}

#view-rule-edit .rule-edit-scenario-footer {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 14px 4px 0;
    flex-shrink: 0;
}

#view-rule-edit .rule-edit-scenario-path {
    font-size: 13px;
    line-height: 1.4;
    color: #6b7280;
}

#view-rule-edit .rule-edit-bottom-actions {
    flex-shrink: 0;
    padding: 16px 0 20px;
}

#view-rule-edit .rule-scenario-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
}

/* ==== ZOOM ==== */
#ruleScenarioZoom {
    transform-origin: top left;
}

#view-rule-edit .rule-zoom-control {
    display: inline-flex;
    align-items: center;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

#view-rule-edit .rule-zoom-btn,
#view-rule-edit .rule-zoom-value {
    height: 32px;
    border: 0;
    background: transparent;
    color: #334155;
    font-size: 13px;
    cursor: pointer;
}

#view-rule-edit .rule-zoom-btn {
    width: 34px;
    min-width: 34px;
    font-size: 15px;
}

#view-rule-edit .rule-zoom-value {
    min-width: 58px;
    padding: 0 10px;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    font-weight: 500;
}

#view-rule-edit .rule-zoom-btn:hover,
#view-rule-edit .rule-zoom-value:hover {
    background: rgba(21, 101, 192, 0.06);
    color: #1565C0;
}












.rule-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 310px;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.rule-node-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #eef2ff;
    font-size: 13px;
}

.rule-node-body {
    min-width: 0;
}

.rule-node-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    color: #111827;

    display: -webkit-box;
    -webkit-line-clamp: 1;
    /* max 1 linie */
    -webkit-box-orient: vertical;

    overflow: hidden;
    text-overflow: ellipsis;
}

.rule-node-subtitle {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.3;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rule-node.is-selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.rule-node-branch,
.rule-node-end {
    width: 290px;
}

.rule-scenario-children {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-left: 56px;
}

.rule-scenario-tree {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.rule-scenario-item {
    position: relative;
}

.rule-scenario-item>.rule-node {
    margin-left: 0;
}

.rule-scenario-item>.rule-scenario-children {
    margin-left: 48px;
}

.rule-scenario-child>.rule-node {
    margin-left: 0;
}

.rule-scenario-child>.rule-scenario-children {
    margin-left: 48px;
}

.rule-scenario-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 1;
}

.rule-scenario-nodes {
    position: relative;
    z-index: 2;
}

.rule-scenario-tree {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.rule-scenario-item {
    position: relative;
}

.rule-scenario-item>.rule-node {
    margin-left: 0;
}

.rule-scenario-item>.rule-scenario-children {
    margin-left: 48px;
    margin-top: 18px;
}

.rule-scenario-child>.rule-node {
    margin-left: 0;
}

.rule-scenario-child>.rule-scenario-children {
    margin-left: 48px;
    margin-top: 14px;
}

/* ==== HIGHLIGHT LINES NODES ==== */
.rule-scenario-line {
    transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.rule-scenario-line.is-active {
    stroke: #3b82f6;
    stroke-width: 2.5;
}

/* ==== HOVER NODES ==== */
.rule-scenario-line.is-hover {
    stroke: #93c5fd;
    stroke-width: 2.5;
}





/* ==== CONTEKST ==== */
.context-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ==== CONTEKST RULE SETTINGS ==== */
.context-box {
    overflow: visible;
}

.rule-context-row-switch {
    margin-top: 12px;
}

.rule-context-row-time {
    margin-top: 18px;
}

.rule-context-switch {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.rule-context-row-switch .routing-section {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.rule-context-row-switch .rule-context-switch {
    width: auto;
}

.rule-context-row-time .routing-section {
    margin-left: auto;
}


.rule-context-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rule-context-warning {
    margin-top: 12px;
}

/*  ==== CONTEXT EDIT NODES ==== */
.rule-context-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rule-context-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.rule-context-field .sx-input {
    width: 100%;
    min-height: 80px;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.rule-danger-zone {
    margin-top: 12px;
}

.rule-add-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
}

.rule-context-field textarea {
    resize: vertical;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.rule-add-dropdown-wrap {
    position: relative;
}

.rule-context-textarea {
    display: block;
    width: 100%;
    min-height: 90px;
    padding: 10px 12px;
    line-height: 1.4;
    resize: vertical;
    box-sizing: border-box;
}

.rule-children-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-child-row>* {
    min-width: 0;
}

.rule-child-row {
    display: grid;
    grid-template-columns: 32px 32px minmax(0, 1fr) 72px;
    align-items: center;
    gap: 8px;
    width: 100%;
}


.rule-child-move-inline {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rule-child-move-btn:hover {
    color: #1565C0;
}

.rule-child-node {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;

    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    min-height: 40px;

    display: flex;
    align-items: center;
    padding: 0 12px;
}

.rule-child-input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: #111827;
    padding: 0;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    display: -webkit-box;
    -webkit-line-clamp: 1;
    /* max 1 linie */
    -webkit-box-orient: vertical;
}

.rule-child-actions {
    display: contents;
}

.rule-child-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 72px;
    justify-content: flex-start;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.rule-child-row:hover .rule-child-actions {
    opacity: 1;
    pointer-events: auto;
}

.rule-node.is-context-hover {
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.18);
}

.rule-child-row .js-move-up,
.rule-child-row .js-move-down {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.rule-child-row:hover .js-move-up,
.rule-child-row:hover .js-move-down {
    opacity: 1;
    pointer-events: auto;
}

.rule-children-list {
    margin-bottom: 12px;
}

.rule-child-actions-placeholder {
    width: 68px;
    flex-shrink: 0;
}

.rule-child-placeholder {
    visibility: hidden;
    pointer-events: none;
}

/* ==== COMPOSER TOOLBAR ==== */
.rule-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rule-editor-toolbar {
    display: flex;
    gap: 6px;
}

.rule-editor-btn {
    height: 28px;
    min-width: 28px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.rule-editor-btn:hover {
    background: #f3f4f6;
}

.rule-editor-emoji-wrap {
    position: relative;
}

.rule-editor-emoji-panel {
    position: absolute;
    top: 34px;
    left: 0;
    display: flex;
    gap: 6px;
    padding: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.emoji-item {
    cursor: pointer;
    font-size: 16px;
}

.emoji-item:hover {
    transform: scale(1.2);
}

.rule-editor-btn.active {
    background: #1565C0;
    border-color: #1565C0;
    color: #fff;
}

.js-rich-input.is-bold-mode {
    font-weight: 700;
}

.js-rich-input.is-italic-mode {
    font-style: italic;
}

.js-rich-input.is-underline-mode {
    text-decoration: underline;
}

.rule-child-input[contenteditable="true"] {
    width: 100%;
}

.js-rich-input.rule-context-textarea {
    min-height: 90px;
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    resize: vertical;
}

/* ==== CONTEXT SETTINGS ==== */
#view-rule-edit .where-row {
    display: grid;
    grid-template-columns: 72px 90px 1fr 36px;
    gap: 8px;
    align-items: center;
}

#view-rule-edit .where-row .ai-center-badge {
    min-width: 50px;
    height: 36px;
    margin-right: 0;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12px;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: none;
}

#view-rule-edit .where-row .ai-center-badge:hover {
    transform: none !important;
    box-shadow: none !important;
}

#view-rule-edit .where-operator-wrap {
    margin-left: -20px;
    /* 8px gap + 5px wejścia na badge */
    position: relative;
    z-index: 2;
}

#view-rule-edit .where-operator {
    width: 110px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 28px 0 8px;
    background: #fff;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    position: relative;

    display: inline-flex;
    align-items: center;
}

#view-rule-edit .where-operator::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    pointer-events: none;

    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px 14px;

    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%236B7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

#view-rule-edit .where-operator-wrap select {
    width: 110px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 8px;
    background: #fff;
    font-size: 13px;
}

#view-rule-edit .rule-condition-logic {
    font-size: 12px;
    color: #6b7280;
    padding: 4px 0;
}

#view-rule-edit .rule-add-wrap {
    position: relative;
    display: inline-flex;
    margin-top: 15px;
}

#view-rule-edit .rule-add-wrap .dropdown-menu {
    position: absolute;
    top: 42px;
    left: 0;
    z-index: 20;
}

#view-rule-edit #addWhereDropdown {
    position: absolute;
    left: 0;
    top: 40px;
    z-index: 50;
    min-width: 160px;
}

#view-rule-edit #whereList {
    margin-top: 10px;
}


/* Settings Who where... */
#view-rule-edit .rule-settings-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    border: none;
    background: transparent;
    color: #1565C0;

    cursor: pointer;
    padding: 0;
}

#view-rule-edit .rule-settings-edit-btn svg {
    width: 24px;
    height: 24px;
}

#view-rule-edit .rule-settings-edit-btn:hover {
    background: transparent;
    color: #1565C0;
}

#view-rule-edit .rule-settings-item {
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;

    border: 1px solid #e5e7eb;
    /* 🔹 delikatna systemowa ramka */
    background: #fff;
}

#view-rule-edit .rule-settings-item:hover {
    border-color: #3b82f6;
    background: #f8fbff;
}

#view-rule-edit .rule-settings-item.is-active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
    background: #fff;
}

#view-rule-edit .rule-settings-item:active {
    transform: scale(0.995);
}

#view-rule-edit .rule-settings-edit-btn {
    color: #9ca3af;
    /* 🔹 szary jak border */
    transition: color 0.15s ease;
}

#view-rule-edit .rule-settings-item:hover .rule-settings-edit-btn {
    color: #3b82f6;
}

#view-rule-edit .rule-settings-item.is-active .rule-settings-edit-btn {
    color: #3b82f6;
}



/* ==== DROPDOWN OVERFLOW ==== */
#view-rule-edit .where-row {
    position: relative;
    z-index: 1;
    overflow: visible;
}

#view-rule-edit .where-row:has(.js-where-operator-dropdown:not(.hidden)) {
    z-index: 50;
}

#view-rule-edit .where-operator-wrap {
    position: relative;
    overflow: visible;
}

#view-rule-edit .where-operator-wrap .js-where-operator-dropdown {
    position: absolute;
    top: 42px;
    left: 0;
    right: auto;
    width: 110px;
    min-width: 110px;
    z-index: 1000;
}




/* ==== NODE BRANCH EDIT - ACTION BTN ==== */
.rule-action-btn {
    width: 100%;
    justify-content: space-between;

    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #111827;
    margin-bottom: 15px;
}

.rule-action-btn:hover {
    background: #e5e7eb;
}

.rule-action-btn-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rule-action-icon {
    font-size: 14px;
}

.rule-action-chevron {
    font-size: 12px;
    opacity: 0.6;
}

.sx-input--inline {
    min-height: 34px !important;
    height: 34px !important;
    margin-bottom: 20px;
}

.sx-input--inline input {
    height: 100%;
    border: 0;
    outline: none;
    width: 100%;
}

.js-rich-input.is-empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}

/* =====================================
   RULE TEMPLATES HERO
===================================== */

#view-rules .rules-templates-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 180px;
    padding: 18px 34px;
    border: 1px solid #e6e8f5;
    border-radius: var(--radius-md);

    background: rgba(59, 130, 246, 0.02);

}

#view-rules .rules-templates-hero__content {
    flex: 1;
    min-width: 0;
    max-width: 640px;
}

#view-rules .rules-templates-hero__icon {
    display: none;
}

#view-rules .rules-templates-hero__title {
    margin: 0;
    font-size: 30px;
    line-height: 1.08;
    font-weight: 750;
    letter-spacing: -0.04em;
    color: #07122f;
}

#view-rules .rules-templates-hero__desc {
    margin: 12px 0 0;
    font-size: 15px;
    line-height: 1.5;
    color: #64748b;
}

#view-rules .rules-templates-hero__features {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 250px));
    gap: 34px;
    margin-top: 22px;
}

#view-rules .rules-templates-hero__feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

#view-rules .rules-templates-hero__feature:not(:last-child)::after {
    display: none;
}

#view-rules .rules-templates-hero__feature-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-bottom: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f1ff;
    color: #6754f3;
}

#view-rules .rules-templates-hero__feature-icon svg {
    width: 22px;
    height: 22px;
}

#view-rules .rules-templates-hero__feature-text {
    min-width: 0;
}

#view-rules .rules-templates-hero__feature strong {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 700;
    color: #0f172a;
}

#view-rules .rules-templates-hero__feature p {
    margin: 0;
    max-width: 170px;
    color: #64748b;
    line-height: 1.4;
    font-size: 12px;
}

#view-rules .rules-templates-hero__image {
    flex-shrink: 0;
    margin-left: 10px;
    margin-right: -18px;
}

#view-rules .rules-templates-hero__image img {
    display: block;
    width: 220px;
    max-width: none;
}



/* =====================================
   RULE TEMPLATE CARD CONTENT
===================================== */

#view-rules .rules-template-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 220px 150px;
    align-items: start;
    column-gap: 5px;
    cursor: pointer;
}

#view-rules .rules-template-card__icon {
    width: 40px;
    height: 40px;

    margin-left: 16px;
    margin-top: 2px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-md);

    background: #ECFDF3;
    color: #15803D;

    border: 1px solid rgba(22, 163, 74, 0.14);
}

.rules-template-card__icon {
    background: #ECFDF3;
    color: #15803D;
    border-color: rgba(22, 163, 74, 0.14);
}

#view-rules .rules-template-card__icon.is-lead {
    background: #EEF2FF;
    color: #3730A3;
    border-color: rgba(55, 48, 163, 0.16);
}

#view-rules .rules-template-card__icon.is-support {
    background: #EFF6FF;
    color: #1565C0;
    border-color: rgba(21, 101, 192, 0.16);
}


#view-rules .rules-template-card__icon svg {
    width: 27px;
    height: 27px;
}

#view-rules .rules-template-card__content {
    min-width: 0;
}

#view-rules .rules-template-card__title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
    white-space: nowrap;
}

#view-rules .rules-template-card__description {
    margin-top: 8px;
    max-width: 560px;

    font-size: 13px;
    line-height: 1.55;
    color: #64748b;
}

#view-rules .rules-template-card__badges {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 14px;
}

#view-rules .rules-template-card__highlight {
    display: flex;
    align-items: center;
    align-self: center;

    gap: 12px;
    min-width: 0;

    padding-left: 32px;
    border-left: 1px solid #edf2f7;


}

#view-rules .rules-template-card__highlight-icon {
    width: 48px;
    height: 48px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-md);
    background: #ECFDF3;
    color: #15803D;

    border: 1px solid rgba(22, 163, 74, 0.14);
}

#view-rules .rules-template-card__highlight-icon svg {
    width: 20px;
    height: 20px;
}

#view-rules .rules-template-card__highlight-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
}

#view-rules .rules-template-card__highlight-desc {
    margin-top: 5px;
    max-width: 160px;

    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

#view-rules .rules-template-card__action {
    justify-self: end;
    align-self: end;
    margin-top: auto;
    padding-right: 16px;
    box-sizing: border-box;
}

#view-rules .rules-template-card__badges .badge-ui {
    height: 24px;
}

#view-rules .rules-template-card__badges .badge-w-md {
    width: 76px;
}

#view-rules .rules-template-card__badges .badge-template-trigger {
    width: 132px;
}


/* =============================================
   BLOCKING
   ===========================================*/

.blocking-url-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.blocking-url-row .sx-input {
    flex: 1;
}

.blocking-url-row .icon-btn {
    width: 42px;
    height: 36px;
    min-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blocking-url-add {
    margin-top: 12px;
}


/* =============================================
   INPUT
   ===========================================*/
.rules-editor .sx-input--inline>select {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.rule-context-row-time .sx-input--inline>select {
    width: 100%;
    height: 100%;

    border: 0;
    outline: 0;
    background: transparent;

    padding: 0;
    margin: 0;

    font: inherit;
    color: inherit;

    cursor: pointer;
}

/* =============================================
   TEMPALATE RULES LIST
   ===========================================*/
.rules-template-card__description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* =============================================
   TEMPLATE RULES CONTEXT WINDOW
=============================================*/

#view-rules .rule-template-details-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#view-rules .rule-template-details-desc {
    font-size: 13px;
    line-height: 1.55;
    color: #64748b;
}

#view-rules .rule-template-flow-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

#view-rules .rule-template-flow {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-left: 2px;
}

#view-rules .rule-template-flow-step {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    align-items: flex-start;
}

#view-rules .rule-template-flow-step:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 18px;
    top: 42px;
    bottom: -14px;
    width: 1px;
    background: linear-gradient(to bottom, #c7d2fe, rgba(199, 210, 254, 0));
}

#view-rules .rule-template-flow-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef6ff;
    border: 1px solid #bfdbfe;
    color: #1565c0;
    box-shadow: 0 8px 18px rgba(21, 101, 192, 0.08);
}

#view-rules .rule-template-flow-icon svg {
    width: 19px;
    height: 19px;
}

#view-rules .rule-template-flow-label {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#view-rules .rule-template-flow-value {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.45;
    color: #0f172a;
    font-weight: 600;
}

#view-rules .rule-template-flow-step:nth-child(1) .rule-template-flow-icon {
    background: #ecfdf3;
    border-color: rgba(22, 163, 74, 0.18);
    color: #15803d;
}

#view-rules .rule-template-flow-step:nth-child(2) .rule-template-flow-icon {
    background: #f4f1ff;
    border-color: rgba(103, 84, 243, 0.18);
    color: #6754f3;
}

#view-rules .rule-template-flow-step:nth-child(3) .rule-template-flow-icon {
    background: #fff7ed;
    border-color: rgba(249, 115, 22, 0.18);
    color: #ea580c;
}

#view-rules .rule-template-flow-step:nth-child(4) .rule-template-flow-icon {
    background: #eef6ff;
    border-color: #bfdbfe;
    color: #1565c0;
}

#view-rules .rule-detail-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

#view-rules .rule-detail-option {
    padding: 7px 11px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    line-height: 1;
    color: #334155;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

#view-rules .rule-template-effect {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    margin-top: 16px;
    margin-left: 14px;
    margin-right: 14px;
    margin-bottom: 14px;

    padding: 16px;

    border: 1px solid rgba(22, 163, 74, 0.16);
    border-radius: var(--radius-md);

    background: linear-gradient(135deg, #ecfdf3 0%, #ffffff 72%);
}

#view-rules .rule-template-effect.lead {
    border-color: rgba(55, 48, 163, 0.16);

    background: linear-gradient(135deg,
            #EEF2FF 0%,
            #F5F3FF 40%,
            #FFFFFF 75%);
}

#view-rules .rule-template-effect.lead .rule-template-effect-label {
    color: #3730A3;
}

#view-rules .rule-template-effect.support {
    border-color: rgba(21, 101, 192, 0.16);

    background: linear-gradient(135deg,
            #EFF6FF 0%,
            #DBEAFE 40%,
            #FFFFFF 75%);
}

#view-rules .rule-template-effect.support .rule-template-effect-label {
    color: #1565C0;
}

#view-rules .rule-template-effect-content {
    min-width: 0;
}

#view-rules .rule-template-effect-label {
    font-size: 12px;
    font-weight: 700;
    color: #16a34a;
}

#view-rules .rule-template-effect-title {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

#view-rules .rule-template-effect-desc {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

#view-rules .rule-template-effect img {
    width: 92px;
    height: auto;
    flex-shrink: 0;
}

#view-rules .rules-template-card__highlight.is-lead .rules-template-card__highlight-icon {
    background: #EEF2FF;
    color: #3730A3;
    border-color: rgba(55, 48, 163, 0.16);
}

#view-rules .rules-template-card__highlight.is-support .rules-template-card__highlight-icon {
    background: #EFF6FF;
    color: #1565C0;
    border-color: rgba(21, 101, 192, 0.16);
}

/* FIRST NODE CONTEXT */
.rule-trigger-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.rule-trigger-summary-item {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

.rule-trigger-summary-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
}

.rule-trigger-summary-value {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.rule-trigger-summary-item:nth-child(1) .rule-trigger-summary-value {
    color: #15803D;
}

.rule-trigger-summary-item:nth-child(2) .rule-trigger-summary-value {
    color: #1565C0;
}

.rule-trigger-summary-item:nth-child(3) .rule-trigger-summary-value {
    color: #3730A3;
}

.rule-trigger-summary-item:nth-child(4) .rule-trigger-summary-value {
    color: #C2410C;
}

.rule-trigger-summary-item:nth-child(5) .rule-trigger-summary-value {
    color: #B45309;
}



#view-rule-edit .rule-config-hint-box {
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 75%);
    border-color: #bfdbfe;
}

#view-rule-edit .rule-config-hint-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

#view-rule-edit .rule-config-hint-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1565c0;
    border: 1px solid rgba(21, 101, 192, 0.16);

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
}

#view-rule-edit .rule-config-hint-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    font-size: 12px;
    color: #475569;
}

.rule-config-hint-box .settings-context-actions {
    margin-top: 20px;
}


/* =============================================
   MY RULES
   ============================================= */

#view-rules .rule-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 76px;
    padding: 16px 0;

    border-bottom: 1px solid var(--surface-soft-border);
}

#view-rules .rule-row:last-child {
    border-bottom: 0;
}

/* ----------------------------------------- */

#view-rules .rule-row-left {
    display: flex;
    align-items: center;
    gap: 14px;

    min-width: 0;
}

/* ----------------------------------------- */

#view-rules .rule-row-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    border: 1px solid #dbeafe;

    background: linear-gradient(135deg,
            #f8fbff 0%,
            #ffffff 72%);

    color: #1565c0;
}

#view-rules .rule-row-icon svg {
    width: 18px;
    height: 18px;
}

/* ----------------------------------------- */

#view-rules .rule-row-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#view-rules .rule-row-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

#view-rules .rule-row-desc {
    font-size: 12px;
    color: #64748b;
}

/* ----------------------------------------- */

#view-rules .rule-row-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

#view-rules .rule-row-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ----------------------------------------- */

#view-rules .rule-badge-value {
    margin-left: 6px;
    font-weight: 700;
}


#view-rules .rule-row {
    transition:
        background-color 0.15s ease,
        box-shadow 0.15s ease;
}

#view-rules .rule-row:hover {
    background: rgba(59, 130, 246, 0.025);
    cursor: pointer;
}

#view-rules .rule-row.is-selected {
    background: rgba(59, 130, 246, 0.04);
}

#view-rules .rules-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;

    width: 100%;
    padding: 0;
}

#view-rules .rules-panel-header .setting-row-info {
    flex: 1 1 auto;
    min-width: 0;
}

#view-rules .rules-panel-header .list-search {
    flex: 0 0 420px;
    width: 420px;
    margin-left: auto;
}

#view-rules .sx-card-title {
    font-weight: 700;
}

#view-rules .rule-trigger-badge {
    min-width: 130px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* =============================================
   MY RULES — HERO
   ============================================= */

#view-rules .rules-mine-hero {
    background: rgba(59, 130, 246, 0.02);
}

#view-rules .rules-mine-hero-main {
    display: flex;
    align-items: center;
    gap: 50px;
}

#view-rules .rules-mine-hero-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;
}

#view-rules .rules-mine-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

#view-rules .rules-mine-hero-text {
    min-width: 240px;
}

#view-rules .rules-mine-hero-text .sx-card-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin-bottom: 6px;
}

#view-rules .rules-mine-hero-text .setting-row-description {
    font-size: 14px;
    line-height: 1.6;
    color: #64748b;
    max-width: 340px;
}

#view-rules .rules-mine-hero-stats {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

#view-rules .rules-mine-hero-stat {
    min-width: 92px;
    padding: 12px 14px;
    border-radius: var(--radius-md);


    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.96) 0%,
            rgba(248, 250, 252, 0.96) 100%);

    border: 1px solid rgba(148, 163, 184, 0.14);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 1px 2px rgba(15, 23, 42, 0.03);
}

#view-rules .rules-mine-hero-stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
    color: #0f172a;
}

#view-rules .rules-mine-hero-stat-label {
    display: flex;
    align-items: center;
    gap: 6px;

    font-size: 12px;
    color: #64748b;
}

#view-rules .rules-mine-hero-stat-label .badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

#view-rules .rules-mine-hero-stat-label .badge-dot.is-active {
    background: #22c55e;
}

#view-rules .rules-mine-hero-stat-label .badge-dot.is-inactive {
    background: #94a3b8;
}

#view-rules .rules-mine-hero-stat-label .badge-dot.is-total {
    background: #2563eb;
}

/* ---------------------------------------------------------- */

#view-rules .sx-section>.sx-card[data-rules-context] {
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

#view-rules .sx-section>.sx-card[data-rules-context]:hover,
#view-rules .sx-section>.sx-card[data-rules-context].is-context-active {
    border-color: rgba(59, 130, 246, 0.45);
}

#view-rules .rule-context-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    margin-top: 16px;
}

#view-rules .rule-context-stat {
    padding: 12px;

    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: var(--radius-md);

    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.96) 0%,
            rgba(248, 250, 252, 0.96) 100%);
}

#view-rules .rule-context-stat-value {
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
    color: #0f172a;
}

#view-rules .rule-context-stat-label {
    margin-top: 7px;

    font-size: 12px;
    line-height: 1.3;
    color: #64748b;
}

#rulesContextMount {
    padding: 18px;
    box-sizing: border-box;
}

#view-rules .rules-templates-list-wrap[data-rules-context] {
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

#view-rules .rules-templates-list-wrap[data-rules-context].is-context-active {
    border-color: var(--card-border);
    box-shadow: var(--card-shadow);
}

#view-rules .rules-template-card.is-context-active {
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}



/* =====================================================
   RULES — MY RULES HERO <=460
   ===================================================== */

@media (max-width: 460px) {

    #view-rules .rules-mine-hero-main {
        display: block;
    }

    #view-rules .rules-mine-hero-image {
        display: none;
    }

    #view-rules .rules-mine-hero-text .setting-row-description {
        display: none;
    }

    #view-rules .rules-mine-hero-stats {
        margin-top: 14px;
        margin-left: 0;
        justify-content: flex-start;
    }

}


/* =====================================================
   RULES — MOBILE <768
   ===================================================== */

@media (max-width: 767px) {

    #view-rules .rules-templates-hero__image,
    #view-rules .rules-template-card__highlight,
    #view-rules .rules-templates-hero__features,
    #view-rules .rules-mine-hero-image {
        display: none;
    }

    #view-rules .rules-templates-hero {
        min-height: auto;
        padding: 24px;
    }

    #view-rules .rules-templates-hero__content {
        max-width: 100%;
    }

    #view-rules .rules-templates-hero__title {
        font-size: 24px;
    }

    #view-rules .rules-templates-hero__desc {
        margin-top: 12px;
        max-width: 100%;
    }

    #view-rules .rules-template-card {
        grid-template-columns: 52px minmax(0, 1fr);
        grid-template-areas:
            "icon content"
            "icon action";
        column-gap: 14px;
        row-gap: 12px;
        align-items: start;
    }

    #view-rules .rules-template-card__icon {
        grid-area: icon;
        margin: 0 0 0 12px;
        align-self: start;
    }

    #view-rules .rules-template-card__content {
        grid-area: content;
    }

    #view-rules .rules-template-card__action {
        grid-area: action;
        justify-self: start;
        align-self: start;
        padding-right: 0;
        margin-top: 0;
    }

    #view-rules .rules-template-card__action .btn,
    #view-rules .rules-template-card__action .edit-btn {
        pointer-events: none;
        opacity: .55;
        filter: grayscale(.2);
    }

    /* ===== MY RULES HERO ===== */

    #view-rules .rules-mine-hero-text {
        min-width: 0;
        flex: 1 1 auto;
    }

    #view-rules .rules-mine-hero-stats {
        margin-left: auto;
        gap: 8px;
    }

    #view-rules .rules-mine-hero-stat {
        min-width: 68px;
        padding: 9px 10px;
    }

    #view-rules .rules-mine-hero-stat:last-child {
        display: none;
    }

    #view-rules .rules-panel-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    #view-rules .rules-panel-header .list-search {
        flex: 1 1 100%;
        width: 100%;
        margin-left: 0;
    }

    #view-rules .rule-row {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr);
        column-gap: 12px;
        row-gap: 10px;
        align-items: start;
    }

    #view-rules .rule-row-left {
        display: contents;
    }

    #view-rules .rule-row-icon {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    #view-rules .rule-row-content {
        grid-column: 2;
        min-width: 0;
    }

    #view-rules .rule-row-desc {
        display: none;
    }

    #view-rules .rule-row-name {
        white-space: normal;
        line-height: 1.25;
    }

    #view-rules .rule-row-right {
        grid-column: 2;

        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
    }

    #view-rules .rule-row-badges {
        grid-column: 1;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    #view-rules .rule-row-right .switch {
        grid-column: 2;
        flex: 0 0 auto;
        width: 38px;
        min-width: 38px;
    }

    #view-rules .rule-menu-wrap {
        grid-column: 3;
        flex: 0 0 auto;
    }

    #view-rules .rule-menu-wrap {
        display: none;
    }

    #view-rules .rule-row-right {
        width: 100%;
    }

    #view-rules .rule-row-right .switch {
        margin-left: auto;
    }
}




/* =====================================================
   RULES — TABLET 768–1023
   ===================================================== */

@media (min-width: 768px) and (max-width: 1023px) {

    #view-rules .rules-templates-hero__image {
        display: none;
    }

    #view-rules .rules-template-card__highlight {
        display: none;
    }

    #view-rules .rules-template-card {
        grid-template-columns: 52px minmax(0, 1fr) 120px;
        column-gap: 14px;
        align-items: center;
    }

    #view-rules .rules-template-card__action {
        justify-self: end;
        align-self: end;
        padding-right: 12px;
    }

    #view-rules .rules-mine-hero-image {
        display: none;
    }

    #view-rules .rules-mine-hero-stat:last-child {
        display: none;
    }

    #view-rules .rules-mine-hero-main {
        gap: 20px;
    }

    #view-rules .rules-mine-hero-stats {
        margin-left: auto;
        justify-content: flex-end;
    }

    #view-rules .rule-row-desc {
        display: none;
    }

    #view-rules .rule-row {
        align-items: center;
        gap: 14px;
    }

    #view-rules .rule-row-left {
        flex: 1 1 220px;
        min-width: 0;
    }

    #view-rules .rule-row-name {
        white-space: normal;
        line-height: 1.25;
    }

    #view-rules .rule-row-right {
        flex: 0 1 250px;

        display: grid;
        grid-template-columns: minmax(0, 1fr) 38px 36px;
        column-gap: 8px;
        row-gap: 6px;

        align-items: center;
    }

    #view-rules .rule-row-badges {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 6px;
    }

    #view-rules .rule-row-right .switch,
    #view-rules .rule-menu-wrap {
        flex: 0 0 auto;
    }
}




/* =====================================================
   RULES — laptop 1024–1599
   ===================================================== */

@media (min-width: 1024px) and (max-width: 1599px) {

    #view-rules .rules-template-card {
        grid-template-columns: 56px minmax(0, 1fr) 120px;
        column-gap: 16px;
        align-items: center;
    }

    #view-rules .rules-template-card__highlight {
        display: none;
    }

    #view-rules .rules-template-card__action {
        justify-self: end;
        align-self: end;
        padding-right: 16px;
    }

    #view-rules .rules-templates-hero__image img {
        width: 140px;
    }

    #view-rules .rules-mine-hero-main {
        gap: 22px;
    }

    #view-rules .rules-mine-hero-image {
        width: 78px;
        height: 78px;
    }

    #view-rules .rules-mine-hero-text {
        min-width: 170px;
    }

    #view-rules .rules-mine-hero-text .sx-card-title {
        font-size: 18px;
    }

    #view-rules .rules-mine-hero-text .setting-row-description {
        font-size: 13px;
        max-width: 220px;
    }

    #view-rules .rules-mine-hero-stats {
        gap: 8px;
    }

    #view-rules .rules-mine-hero-stat {
        min-width: 74px;
        padding: 10px 12px;
    }

    #view-rules .rules-mine-hero-stat-value {
        font-size: 24px;
    }

    #view-rules .rule-row {
        gap: 16px;
    }

    #view-rules .rule-row-left {
        flex: 1 1 240px;
    }

    #view-rules .rule-row-right {
        flex: 0 1 320px;
        justify-content: flex-end;
    }

    #view-rules .rule-row-badges {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 6px;
    }

    #view-rules .rule-row-right .switch {
        flex: 0 0 auto;
        width: 38px;
        min-width: 38px;
    }

    #view-rules .rule-menu-wrap {
        flex: 0 0 auto;
    }


}



/* =====================================================
   MY RULES HERO ONLY 
   ===================================================== */
/* RULES — MY RULES HERO 1024–1149 */
@media (min-width: 1024px) and (max-width: 1149px) {

    #view-rules .rules-mine-hero-image {
        width: 72px;
        height: 72px;
    }

    #view-rules .rules-mine-hero-stat:last-child {
        display: none;
    }

    #view-rules .rules-mine-hero-stats {
        margin-left: auto;
        justify-content: flex-end;
    }
}

/* RULES — MY RULES HERO 1150–1399 */
@media (min-width: 1150px) and (max-width: 1399px) {

    #view-rules .rules-mine-hero-image {
        width: 92px;
        height: 92px;
    }

    #view-rules .rules-mine-hero-stats {
        margin-left: auto;
        justify-content: flex-end;
        flex: 1;
    }
}

/* RULES — MY RULES HERO 1400–1599 */
@media (min-width: 1400px) and (max-width: 1599px) {

    #view-rules .rules-mine-hero-image {
        width: 105px;
        height: 105px;
    }

    #view-rules .rules-mine-hero-stats {
        margin-left: auto;
        justify-content: flex-end;
        flex: 1;
    }
}



/* =====================================================
   RULES — DESKTOP 1600+ WITH CONTEXT OPEN
   ===================================================== */

@media (min-width: 1600px) {

    body:not(.context-collapsed) #view-rules .rules-templates-hero {
        min-height: 170px;
        padding: 18px 28px;
    }

    body:not(.context-collapsed) #view-rules .rules-templates-hero__title {
        font-size: 26px;
    }

    body:not(.context-collapsed) #view-rules .rules-templates-hero__features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    body:not(.context-collapsed) #view-rules .rules-templates-hero__image img {
        width: 140px;
    }

    body:not(.context-collapsed) #view-rules .rules-template-card {
        grid-template-columns: 56px minmax(0, 1fr) 170px 120px;
        column-gap: 22px;
        align-items: center;
    }

    body:not(.context-collapsed) #view-rules .rules-template-card__icon {
        width: 40px;
        height: 40px;
        margin-left: 16px;
    }

    body:not(.context-collapsed) #view-rules .rules-template-card__title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    body:not(.context-collapsed) #view-rules .rules-template-card__badges {
        flex-wrap: wrap;
        gap: 6px;
    }

    body:not(.context-collapsed) #view-rules .rules-template-card__highlight {
        padding-left: 16px;
        gap: 10px;
    }

    body:not(.context-collapsed) #view-rules .rules-template-card__highlight-icon {
        width: 42px;
        height: 42px;
    }

    body:not(.context-collapsed) #view-rules .rules-template-card__highlight-desc {
        max-width: 120px;
    }

    body:not(.context-collapsed) #view-rules .rules-template-card__action .btn,
    body:not(.context-collapsed) #view-rules .rules-template-card__action .edit-btn {
        min-width: 110px;
    }

    body:not(.context-collapsed) #view-rules .rules-mine-hero-main {
        gap: 28px;
    }

    body:not(.context-collapsed) #view-rules .rules-mine-hero-image {
        width: 90px;
        height: 90px;
    }

    body:not(.context-collapsed) #view-rules .rules-mine-hero-text {
        min-width: 200px;
    }

    body:not(.context-collapsed) #view-rules .rules-mine-hero-stats {
        gap: 10px;
    }

    body:not(.context-collapsed) #view-rules .rules-mine-hero-stat {
        min-width: 74px;
        padding: 10px 12px;
    }

    body:not(.context-collapsed) #view-rules .rules-mine-hero-stat-value {
        font-size: 24px;
    }

    body:not(.context-collapsed) #view-rules .rules-mine-hero-stat:last-child {
        display: none;
    }

    body:not(.context-collapsed) #view-rules .rule-row {
        gap: 16px;
    }

    body:not(.context-collapsed) #view-rules .rule-row-left {
        flex: 1 1 240px;
    }

    body:not(.context-collapsed) #view-rules .rule-row-right {
        flex: 0 1 320px;
        justify-content: flex-end;
    }

    body:not(.context-collapsed) #view-rules .rule-row-badges {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 6px;
    }

    body:not(.context-collapsed) #view-rules .rule-trigger-badge {
        min-width: 110px;
    }

    body:not(.context-collapsed) #view-rules .rule-row-right .switch {
        flex: 0 0 auto;
        width: 38px;
        min-width: 38px;
    }

    body:not(.context-collapsed) #view-rules .rule-menu-wrap {
        flex: 0 0 auto;
    }


}