/* ===== COMPARE TAB PANEL ===== */
.cmp-panel {
    display: none;
    flex-direction: column;
    height: 100%;
}

.cmp-panel.active {
    display: flex;
}

.cmp-toolbar {
    height: 34px;
    padding: 0 8px;
    gap: 8px;
}

.cmp-toolbar .toolbar-btn,
.cmp-grid-toolbar .toolbar-btn {
    width: auto;
    height: auto;
    padding: 3px 10px;
    gap: 4px;
    border: 1px solid #c0c0c0;
    border-radius: 3px;
    background: linear-gradient(to bottom, #fff, #f0f0f0);
    color: #333;
    white-space: nowrap;
}

.cmp-toolbar .toolbar-btn:hover,
.cmp-grid-toolbar .toolbar-btn:hover {
    background: linear-gradient(to bottom, #f0f0f0, #e0e0e0);
    border-color: #999;
}

.cmp-toolbar .toolbar-btn:active,
.cmp-grid-toolbar .toolbar-btn:active {
    background: #ddd;
}

.cmp-toolbar .toolbar-btn:disabled,
.cmp-grid-toolbar .toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cmp-status {
    color: #666;
    flex: 1;
    text-align: right;
    padding-right: 8px;
}

/* ===== FILTER BOX ===== */
.cmp-filter-box {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #c0c0c0;
    border-radius: 3px;
    overflow: hidden;
    height: 24px;
    background: #fff;
    flex-shrink: 0;
}

.cmp-filter-mode {
    border: none;
    outline: none;
    font-size: 11px;
    height: 100%;
    padding: 0 4px;
    background: #f0f0f0;
    border-right: 1px solid #c0c0c0;
    color: #333;
    cursor: pointer;
    appearance: auto;
}

.cmp-filter-input {
    border: none;
    outline: none;
    font-size: 12px;
    width: 150px;
    background: transparent;
    padding: 0 6px;
    height: 100%;
}

.cmp-filter-clear {
    background: none;
    border: none;
    border-left: 1px solid #e0e0e0;
    cursor: pointer;
    color: #999;
    font-size: 11px;
    padding: 0 6px;
    height: 100%;
    display: flex;
    align-items: center;
}

.cmp-filter-clear:hover {
    color: #c62828;
    background: #fce4ec;
}

/* ===== CELL EDIT (read-only copy) ===== */
.cmp-cell-edit {
    width: 100%;
    border: 1px solid #1976d2;
    outline: none;
    font-size: 12px;
    padding: 0 4px;
    background: #fff;
    font-family: inherit;
    box-sizing: border-box;
    height: 22px;
}

.cmp-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.cmp-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.cmp-side-left {
    border-right: 2px solid #dee2e6;
}

.cmp-side-header {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    flex-shrink: 0;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmp-header-source {
    background: linear-gradient(135deg, #1565c0, #42a5f5);
}

.cmp-header-target {
    background: linear-gradient(135deg, #2e7d32, #66bb6a);
}

.cmp-side-tree {
    flex: 1;
    overflow: auto;
    padding: 6px 4px;
    font-size: 13px;
    user-select: none;
}

/* ===== COMPARE TREE ===== */
.cmp-tree-cat {
    margin-bottom: 2px;
}

.cmp-tree-cat-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.1s;
    font-weight: 500;
}

.cmp-tree-cat-header:hover {
    background: #e9ecef;
}

.cmp-toggle {
    font-size: 10px;
    color: #666;
    width: 12px;
    text-align: center;
    transition: transform 0.15s;
}

.cmp-toggle-open {
    transform: rotate(90deg);
}

.cmp-cat-icon {
    font-size: 12px;
    color: #e8a840;
    width: 16px;
    text-align: center;
}
.cmp-cat-icon-img {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.cmp-cat-label {
    font-size: 13px;
    color: #333;
}

.cmp-badge {
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.cmp-tree-cat-items {
    padding-left: 12px;
}

/* ===== TREE ITEMS ===== */
.cmp-tree-item {
    margin: 1px 0;
}

.cmp-tree-item-label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.1s;
}

.cmp-tree-item-label:hover {
    background: #e9ecef;
}

.cmp-tree-item-label.selected {
    background: #d6e4f0;
}

.cmp-item-toggle {
    font-size: 9px;
    color: #666;
    width: 10px;
    text-align: center;
    transition: transform 0.15s;
    flex-shrink: 0;
}

.cmp-item-toggle-space {
    display: inline-block;
    width: 10px;
    flex-shrink: 0;
}

.cmp-item-icon {
    font-size: 11px;
    color: #6c8ebf;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}
.cmp-item-icon-img {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.cmp-tree-item-children {
    padding-left: 24px;
}

/* ===== ITEM STATUS COLORS ===== */
.cmp-item-equal {
    color: #333;
}

.cmp-item-diff .cmp-tree-item-label span {
    color: #c62828;
    font-weight: 500;
}

.cmp-item-diff .cmp-item-icon {
    color: #c62828;
}
.cmp-item-diff .cmp-item-icon-img {
    filter: hue-rotate(300deg) saturate(3);
}

.cmp-item-missing {
    opacity: 0.45;
}

.cmp-item-missing .cmp-tree-item-label span {
    color: #999;
    font-style: italic;
}

.cmp-item-missing .cmp-item-icon {
    color: #bbb;
}
.cmp-item-missing .cmp-item-icon-img {
    opacity: 0.4;
}

.cmp-item-extra .cmp-tree-item-label span {
    color: #333;
}

/* ===== COLUMN COMPARISON ===== */
.cmp-col-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 1px 4px;
    font-size: 12px;
    border-radius: 2px;
}

.cmp-col-icon {
    font-size: 10px;
    width: 12px;
    text-align: center;
    color: #888;
    flex-shrink: 0;
}

.cmp-col-name {
    font-weight: 500;
}

.cmp-col-type {
    color: #888;
    font-size: 11px;
}

.cmp-col-equal {
    color: #333;
}

.cmp-col-diff {
    color: #c62828;
}

.cmp-col-diff .cmp-col-icon {
    color: #c62828;
}

.cmp-col-diff .cmp-col-name {
    font-weight: 600;
}

.cmp-col-missing {
    opacity: 0.4;
    color: #999;
    font-style: italic;
}

.cmp-col-missing .cmp-col-icon {
    color: #bbb;
}

.cmp-col-extra {
    color: #333;
}

/* ===== BOTTOM PANELS (missing records) ===== */
.cmp-bottom {
    display: flex;
    border-top: 2px solid #dee2e6;
    flex-shrink: 0;
    height: 0;
    overflow: hidden;
    transition: height 0.2s ease;
}

.cmp-bottom:has(.cmp-bottom-side.active) {
    height: 260px;
}

.cmp-bottom-side {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.cmp-bottom-side.active {
    display: flex;
}

.cmp-bottom-left {
    border-right: 2px solid #dee2e6;
}

.cmp-bottom-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    background: #f5f5f5;
    border-bottom: 1px solid #dee2e6;
    color: #444;
    flex-shrink: 0;
}

.cmp-bottom-count {
    font-weight: 400;
    color: #888;
    font-size: 11px;
}

.cmp-bottom-grid {
    flex: 1;
    overflow: hidden;
    font-size: 12px;
    display: flex;
    flex-direction: column;
}

.cmp-bottom-loading,
.cmp-bottom-empty,
.cmp-bottom-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: #888;
    font-size: 12px;
}

.cmp-bottom-error {
    color: #c62828;
}

.cmp-bottom-empty {
    color: #2e7d32;
}

/* Grid table */
.cmp-grid-scroll {
    flex: 1;
    overflow: auto;
}

.cmp-result-table {
    width: max-content;
}

.cmp-grid-toolbar {
    gap: 10px;
    padding: 4px 8px;
}

.cmp-btn-insert.btn-done {
    background: linear-gradient(to bottom, #4caf50, #43a047) !important;
    border-color: #388e3c !important;
    color: #fff !important;
    cursor: default;
}

.cmp-grid-info {
    font-size: 11px;
    color: #888;
    margin-left: auto;
}

/* ===== PROGRESS PANEL ===== */
.cmp-progress-panel {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    gap: 10px;
}

.cmp-progress-bar-wrapper {
    position: relative;
    height: 22px;
    background: #e9ecef;
    border-radius: 11px;
    overflow: hidden;
}

.cmp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
    border-radius: 11px;
    transition: width 0.3s ease;
    min-width: 0;
}

.cmp-progress-percent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #333;
    pointer-events: none;
}

.cmp-progress-step {
    font-size: 12px;
    color: #1565c0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cmp-progress-log {
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cmp-log-entry {
    font-size: 11px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 1px 0;
}

.cmp-log-icon {
    color: #43a047;
    font-size: 9px;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}
