﻿.stage-rule-panel
{
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    background: var(--panel);
}

.stage-rule-header
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.stage-rule-header h2
{
    margin: 0;
    font-size: 22px;
}

.stage-rule-header p
{
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-dim);
}

.stage-rule-header-actions
{
    display: flex;
    gap: 8px;
    align-items: center;
}

.stage-rule-action
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 13px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    background: #ffffff;
    cursor: pointer;
}

.stage-rule-action.primary
{
    border-color: var(--accent);
    color: #ffffff;
    background: var(--accent);
}

.stage-rule-action:hover,
.stage-rule-action:focus
{
    border-color: var(--accent-hover);
    outline: none;
}

.stage-rule-action svg
{
    width: 16px;
    height: 16px;
}

.stage-rule-content
{
    padding: 24px;
    overflow-y: auto;
}

.stage-rule-list
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    max-width: 1180px;
}

.stage-rule-card
{
    display: grid;
    gap: 14px;
    align-content: start;
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(19, 41, 48, 0.04);
}

.stage-rule-card:hover,
.stage-rule-card:focus
{
    border-color: #8bcfc6;
    background: #f7fbfa;
    box-shadow: 0 8px 24px rgba(19, 41, 48, 0.08);
    outline: none;
}

.stage-rule-card.active
{
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(18, 131, 116, 0.16);
}

.stage-rule-card-header
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.stage-rule-card-edit
{
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-dim);
    background: transparent;
    cursor: pointer;
}

.stage-rule-card-edit:hover,
.stage-rule-card-edit:focus
{
    border-color: var(--border);
    color: var(--text);
    background: #ffffff;
    outline: none;
}

.stage-rule-card-edit svg
{
    width: 15px;
    height: 15px;
}

.stage-rule-card-title
{
    min-width: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.35;
}

.stage-rule-card-description
{
    border-top: 1px solid #dcebe8;
    padding-top: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-hover);
    line-height: 1.55;
}

.stage-rule-card-preview
{
    display: grid;
    gap: 7px;
    border-left: 3px solid #8bcfc6;
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    background: #f3faf8;
}

.stage-rule-card-preview-label
{
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-hover);
}

.stage-rule-card-preview-text
{
    margin: 0;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.65;
}

.stage-rule-empty
{
    grid-column: 1 / -1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    color: var(--text-dim);
    background: var(--panel-soft);
}

.stage-rule-dialog-backdrop
{
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(10, 20, 24, 0.38);
}

.stage-rule-dialog-backdrop[hidden]
{
    display: none;
}

.stage-rule-dialog
{
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(680px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 20px 60px rgba(19, 41, 48, 0.2);
}

.stage-rule-dialog-header
{
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.stage-rule-dialog-header h3
{
    margin: 0;
    font-size: 18px;
}

.stage-rule-dialog-header p
{
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--text-dim);
}

.stage-rule-dialog-header-actions
{
    display: flex;
    gap: 4px;
    align-items: center;
}

.stage-rule-dialog-icon,
.stage-rule-dialog-close
{
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-dim);
    background: transparent;
    cursor: pointer;
}

.stage-rule-dialog-icon:hover,
.stage-rule-dialog-icon:focus,
.stage-rule-dialog-close:hover,
.stage-rule-dialog-close:focus
{
    border-color: var(--border);
    color: var(--text);
    background: #ffffff;
    outline: none;
}

.stage-rule-dialog-icon[hidden]
{
    display: none;
}

.stage-rule-dialog-icon svg,
.stage-rule-dialog-close svg
{
    width: 17px;
    height: 17px;
}

.stage-rule-dialog-body
{
    overflow-y: auto;
    padding: 20px;
}

.stage-rule-detail-form
{
    display: grid;
    gap: 12px;
}

.stage-rule-detail-field
{
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
}

.stage-rule-detail-field span
{
    color: var(--text-dim);
}

.stage-rule-detail-field input,
.stage-rule-detail-field textarea
{
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 10px;
    font: inherit;
    font-weight: 500;
    color: var(--text);
    background: #ffffff;
}

.stage-rule-detail-field textarea
{
    resize: vertical;
    min-height: 86px;
    line-height: 1.5;
}

.stage-rule-detail-field input[readonly]
{
    color: var(--text-dim);
    background: var(--panel-soft);
}

.stage-rule-array-editor
{
    display: grid;
    gap: 8px;
}

.stage-rule-array-list
{
    display: grid;
    gap: 8px;
}

.stage-rule-array-item
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.stage-rule-array-remove,
.stage-rule-array-add
{
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.stage-rule-array-remove
{
    min-height: 38px;
    padding: 0 10px;
}

.stage-rule-array-add
{
    justify-self: start;
    min-height: 34px;
    padding: 0 12px;
}

.stage-rule-array-remove:hover,
.stage-rule-array-remove:focus,
.stage-rule-array-add:hover,
.stage-rule-array-add:focus
{
    border-color: #8bcfc6;
    outline: none;
}

.stage-rule-dialog-actions
{
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

.stage-rule-dialog-actions-left,
.stage-rule-dialog-actions-right
{
    display: flex;
    gap: 8px;
    align-items: center;
}

.stage-rule-dialog-action
{
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    background: #ffffff;
    cursor: pointer;
}

.stage-rule-dialog-action.primary
{
    border-color: var(--accent);
    color: #ffffff;
    background: var(--accent);
}

.stage-rule-dialog-action.danger
{
    border-color: #f1b8b1;
    color: #b42318;
}

.stage-rule-dialog-action:hover,
.stage-rule-dialog-action:focus
{
    border-color: var(--accent-hover);
    outline: none;
}

