/* JournalEvent / JournalRule setup — single card, left/right panels (like JournalRuleTest) */

.view-journal-event.gs-page-detail,
.view-journal-rule.gs-page-detail {
    overflow: hidden;
}

.journal-setup-card.gs-card > .rz-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 1rem;
}

.journal-setup-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rz-base-300, #e0e0e0);
    margin-bottom: 0.75rem;
}

.journal-setup-title {
    min-width: 0;
}

.journal-setup-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.journal-setup-body {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 1rem;
    overflow: hidden;
}

.journal-setup-left {
    width: 520px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    padding-right: 0.5rem;
    border-right: 1px solid var(--rz-base-300, #e0e0e0);
}

.journal-setup-right {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

.journal-setup-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
    border-bottom: 1px solid var(--rz-base-300, #e0e0e0);
}

.journal-setup-section-title {
    flex-shrink: 0;
    font-weight: 600;
}

.journal-setup-section-toolbar {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

.journal-setup-table-fill {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* Basic info：上 label、下 input（覆蓋 gs-detail-form 的左右 descriptions 版型） */
.journal-setup-left .journal-setup-form,
.journal-setup-left .gs-detail-form {
    width: 100%;
}

.journal-setup-left .gs-form-fields.rz-row,
.journal-setup-left .gs-detail-form .gs-form-fields.rz-row {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.85rem 1rem;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-sizing: border-box;
}

.journal-setup-left .gs-form-fields > .rz-col,
.journal-setup-left .gs-form-fields > .rz-col-md-6,
.journal-setup-left .gs-form-fields > .rz-col-12,
.journal-setup-left .gs-detail-form .gs-form-fields > .rz-col,
.journal-setup-left .gs-detail-form .gs-form-fields > .rz-col-md-6,
.journal-setup-left .gs-detail-form .gs-form-fields > .rz-col-12 {
    display: block !important;
    grid-column: auto !important;
    grid-template-columns: none !important;
    width: calc(50% - 0.5rem) !important;
    max-width: calc(50% - 0.5rem) !important;
    flex: 0 0 calc(50% - 0.5rem);
    min-width: 0;
    box-sizing: border-box;
}

/* SizeMD="12" 全寬欄位（如 remark） */
.journal-setup-left .gs-form-fields > .rz-col-md-12,
.journal-setup-left .gs-detail-form .gs-form-fields > .rz-col-md-12 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100%;
}

.journal-setup-left .gs-form-item,
.journal-setup-left .gs-detail-form .gs-form-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    margin: 0;
    gap: 0.3rem;
}

.journal-setup-left .gs-form-label,
.journal-setup-left .gs-detail-form .gs-form-label {
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7280;
    line-height: 1.3;
    background: transparent !important;
}

.journal-setup-left .gs-form-control,
.journal-setup-left .gs-detail-form .gs-form-control {
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 0;
    background: transparent !important;
}

.journal-setup-left .gs-form-control > .rz-textbox,
.journal-setup-left .gs-form-control > .rz-dropdown,
.journal-setup-left .gs-form-control > .rz-numeric,
.journal-setup-left .gs-form-control > .rz-datepicker,
.journal-setup-left .gs-form-control > .rz-textarea,
.journal-setup-left .gs-form-field-control {
    width: 100% !important;
    max-width: 100% !important;
}

@media (max-width: 1100px) {
    .journal-setup-left .gs-form-fields > .rz-col,
    .journal-setup-left .gs-form-fields > .rz-col-md-6,
    .journal-setup-left .gs-form-fields > .rz-col-12,
    .journal-setup-left .gs-detail-form .gs-form-fields > .rz-col,
    .journal-setup-left .gs-detail-form .gs-form-fields > .rz-col-md-6,
    .journal-setup-left .gs-detail-form .gs-form-fields > .rz-col-12 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100%;
    }
}

/* Parameter / condition / line tables */
.journal-event-parameter-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.journal-event-parameter-table-wrap {
    overflow-x: auto;
}

.journal-event-parameter-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.journal-event-parameter-table th,
.journal-event-parameter-table td {
    border: 1px solid #e0e0e0;
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: middle;
}

.journal-event-parameter-table th {
    background: #f5f5f5;
    font-weight: 600;
    white-space: nowrap;
}

.journal-event-parameter-table tbody tr:hover {
    background: #fafafa;
}

.journal-event-parameter-table .actions-cell {
    white-space: nowrap;
    width: 1%;
}

.journal-event-parameter-table .empty-cell {
    text-align: center;
    color: #888;
    padding: 1.5rem;
}

.journal-event-parameter-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.journal-event-field-hint {
    font-size: 1rem;
    margin-left: 4px;
    cursor: help;
    vertical-align: middle;
}

@media (max-width: 960px) {
    .journal-setup-body {
        flex-direction: column;
        overflow: auto;
    }

    .journal-setup-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--rz-base-300, #e0e0e0);
        padding-right: 0;
        padding-bottom: 0.75rem;
        max-height: 45vh;
    }

    .journal-setup-right {
        min-height: 320px;
    }
}
