/* GL 公式編輯器（Event computed / Rule amount）— Dialog + Sortable 需全域樣式，不可僅靠 scoped */

/* ---- computed expr (JournalEventParameterDialog) ---- */
.computed-expr-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.computed-expr-palette {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.computed-expr-palette-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color, #6b7280);
}

.computed-expr-palette-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.computed-expr-palette-sortable {
    display: inline-flex;
}

.computed-expr-palette-chip {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: grab;
    user-select: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.computed-expr-palette-chip:active {
    cursor: grabbing;
}

.computed-expr-palette-chip--param {
    background: #e8f4fd;
    border-color: #90caf9;
    color: #1565c0;
}

.computed-expr-palette-chip--constant {
    background: #f3e8fd;
    border-color: #ce93d8;
    color: #6a1b9a;
}

.computed-expr-palette-chip--operator {
    background: #fff8e1;
    border-color: #ffe082;
    color: #f57f17;
}

.computed-expr-options {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    border-top: 1px solid var(--rz-base-300, #e0e0e0);
    width: 100%;
}

.computed-expr-options .computed-expr-options-switch {
    margin-left: auto;
}

.computed-expr-options-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color, #6b7280);
    margin-right: 0.5rem;
}

.computed-expr-option-label {
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.computed-expr-dropzone-wrap {
    position: relative;
    min-height: 200px;
    border: 2px dashed var(--rz-base-400, #bdbdbd);
    border-radius: 8px;
    background: var(--rz-base-100, #fafafa);
}

.computed-expr-dropzone {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: stretch;
    height: 100%;
    min-height: 200px;
    padding: 0.75rem;
    box-sizing: border-box;
}

.computed-expr-dropzone > * {
    width: 100%;
}

.computed-expr-dropzone--empty {
    align-items: center;
    justify-content: center;
}

.computed-expr-dropzone-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: var(--rz-text-secondary-color, #9e9e9e);
    font-size: 0.9rem;
    padding: 1rem;
    text-align: center;
}

.computed-expr-token {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--rz-base-300, #e0e0e0);
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}

.computed-expr-token-handle:active {
    cursor: grabbing;
}

.computed-expr-token--param {
    border-left: 3px solid #1565c0;
}

.computed-expr-token--constant {
    border-left: 3px solid #6a1b9a;
}

.computed-expr-token--operator {
    border-left: 3px solid #f57f17;
}

.computed-expr-token-handle {
    color: var(--rz-text-secondary-color, #9e9e9e);
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
    cursor: grab;
}

.computed-expr-token-control {
    flex: 1;
    min-width: 0;
    max-width: none;
    width: 100%;
}

.computed-expr-preview {
    padding: 0.5rem 0.75rem;
    background: var(--rz-base-200, #f4f5f7);
    border-radius: 6px;
    font-size: 0.95rem;
}

.computed-expr-preview-label {
    color: var(--rz-text-secondary-color, #6b7280);
}

.computed-expr-preview-text {
    font-weight: 600;
}

.computed-expr-header {
    display: flex;
    align-items: center;
}

.computed-expr-actions {
    margin-left: auto;
}

/* ---- amount expr (JournalRuleLineDialog) ---- */
.amount-expr-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.amount-expr-palette {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.amount-expr-palette-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color, #6b7280);
}

.amount-expr-palette-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.amount-expr-palette-sortable {
    display: inline-flex;
}

.amount-expr-palette-chip {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: grab;
    user-select: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.amount-expr-palette-chip:active {
    cursor: grabbing;
}

.amount-expr-palette-chip--param {
    background: #e8f4fd;
    border-color: #90caf9;
    color: #1565c0;
}

.amount-expr-palette-chip--constant {
    background: #f3e8fd;
    border-color: #ce93d8;
    color: #6a1b9a;
}

.amount-expr-palette-chip--operator {
    background: #fff8e1;
    border-color: #ffe082;
    color: #f57f17;
}

.amount-expr-options {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    border-top: 1px solid var(--rz-base-300, #e0e0e0);
    width: 100%;
}

.amount-expr-options .amount-expr-options-switch {
    margin-left: auto;
}

.amount-expr-options-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color, #6b7280);
    margin-right: 0.5rem;
}

.amount-expr-option-label {
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.amount-expr-dropzone-wrap {
    position: relative;
    min-height: 200px;
    border: 2px dashed var(--rz-base-400, #bdbdbd);
    border-radius: 8px;
    background: var(--rz-base-100, #fafafa);
}

.amount-expr-dropzone {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: stretch;
    height: 100%;
    min-height: 200px;
    padding: 0.75rem;
    box-sizing: border-box;
}

.amount-expr-dropzone > * {
    width: 100%;
}

.amount-expr-dropzone--empty {
    align-items: center;
    justify-content: center;
}

.amount-expr-dropzone-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: var(--rz-text-secondary-color, #9e9e9e);
    font-size: 0.9rem;
    padding: 1rem;
    text-align: center;
}

.amount-expr-token {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--rz-base-300, #e0e0e0);
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}

.amount-expr-token-handle:active {
    cursor: grabbing;
}

.amount-expr-token--param {
    border-left: 3px solid #1565c0;
}

.amount-expr-token--constant {
    border-left: 3px solid #6a1b9a;
}

.amount-expr-token--operator {
    border-left: 3px solid #f57f17;
}

.amount-expr-token-handle {
    color: var(--rz-text-secondary-color, #9e9e9e);
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
    cursor: grab;
}

.amount-expr-token-control {
    flex: 1;
    min-width: 0;
    max-width: none;
    width: 100%;
}

.amount-expr-preview {
    padding: 0.5rem 0.75rem;
    background: var(--rz-base-200, #f4f5f7);
    border-radius: 6px;
    font-size: 0.95rem;
}

.amount-expr-preview-label {
    color: var(--rz-text-secondary-color, #6b7280);
}

.amount-expr-preview-text {
    font-weight: 600;
}

.amount-expr-header {
    display: flex;
    align-items: center;
}

.amount-expr-actions {
    margin-left: auto;
}
