/* Based on shadcn/ui defaults - adjust as needed */
:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem; /* Default border radius */

    /* Custom variables */
    --primary-legacy: #4361ee; /* Keep old primary for reference if needed */
    --primary-dark-legacy: #3a56d4;
    --secondary: #3f37c9;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --border-radius: 0.375rem;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease; /* Keep existing transition */
}

/* Reset and Base Body Styles */
*, *::before, *::after {
    box-sizing: border-box;
    border-width: 0;
    border-style: solid;
    border-color: hsl(var(--border));
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    font-family: 'Inter', sans-serif; /* Use Inter font */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


body {
    margin: 0;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    min-height: 100vh;
    /* Remove old body styles */
    /* font-family: 'Inter', -apple-system, BlurMacSystemFont, sans-serif; */
    /* background-color: #f5f7fa; */
    /* color: var(--dark); */
    /* line-height: 1.5; */
}

/* Basic Typography - Adjust as needed */
h1 {
    font-size: 1.875rem; /* ~30px */
    line-height: 2.25rem; /* ~36px */
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

h2 {
    font-size: 1.5rem; /* ~24px */
    line-height: 2rem; /* ~32px */
    font-weight: 600;
    letter-spacing: -0.025em;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 0.5rem; /* pb-2 */
    margin-top: 0; /* Reset */
    margin-bottom: 1rem; /* mb-4 */
}

h3 {
    font-size: 1.25rem; /* ~20px */
    line-height: 1.75rem; /* ~28px */
    font-weight: 600;
    letter-spacing: -0.025em;
    margin: 0;
}

h4 {
    font-size: 1.125rem; /* ~18px */
    line-height: 1.75rem; /* ~28px */
    font-weight: 600;
    letter-spacing: -0.025em;
    margin: 0;
}

p {
    margin: 0 0 1rem 0; /* Add bottom margin to paragraphs */
    line-height: 1.75;
    color: hsl(var(--muted-foreground));
}

/* Remove old container styles - Keep this comment */
/* .config-area, .output-area { */
    /* background-color: #fff; */
    /* padding: 15px; */
    /* margin-bottom: 20px; */
    /* border-radius: 5px; */
    /* box-shadow: 0 2px 4px rgba(0,0,0,0.1); */
/* } */

/* .config-area > div { */
    /* margin-bottom: 10px; */
/* } */

/* New Config Tab Styles */
.config-tabs-container {
    background-color: #fff;
    margin: 0 1.25rem 1rem 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    flex-shrink: 0;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.05);
}

/* New Header within Tabs */
.config-tabs-header {
    display: flex;
    align-items: center; /* Vertically align items */
    justify-content: space-between; /* Push items apart */
    background-color: #f8f9fa; /* Keep header background */
    border-bottom: 1px solid #dee2e6; /* Keep border below header */
    padding: 0 15px; /* Remove top/bottom padding, rely on button padding */
}
.config-tabs-header h1 {
    margin: 0; /* Remove default h1 margin */
    padding-right: 20px; /* Space between title and buttons */
}

.config-tab-buttons {
    display: flex;
    /* background-color: #f8f9fa; */ /* Moved to header */
    /* border-bottom: 1px solid #dee2e6; */ /* Moved to header */
}

.config-tab-button {
    padding: 12px 18px; /* Slightly increase padding */
    cursor: pointer;
    border: none; /* Remove all borders initially */
    border-top: 3px solid transparent; /* Top border for active state */
    background-color: transparent; /* Make inactive tabs transparent */
    color: #495057; /* Slightly muted color for inactive tabs */
    font-size: 0.95em; /* Slightly smaller font */
    margin-right: 2px;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; /* Add color transition */
    white-space: nowrap; /* Prevent buttons wrapping */
    position: relative; /* Needed for potential future pseudo-elements */
    bottom: -1px; /* Align with panel top border */
}

.config-tab-button:hover {
    background-color: #f8f9fa; /* Subtle background on hover */
    color: #0056b3; /* Darker blue on hover */
    border-top-color: #dee2e6; /* Subtle top border hint on hover */
}

/* Close Button Style */
.config-close-button {
    background: none;
    border: none;
    font-size: 1.8em;
    color: #6c757d;
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
    margin-left: 10px; /* Space between tabs and close button */
}
.config-close-button:hover {
    color: #343a40;
}

.config-tab-button.active {
    font-weight: 600; /* Slightly bolder */
    color: #007bff; /* Active tab color */
    background-color: #fff; /* Match panel background */
    border-top-color: #007bff; /* Use top border for active indicator */
    border-bottom-color: #fff; /* Make bottom blend with panel */
}

.config-tab-panels {
    padding: 15px;
}

.config-tab-panel {
    display: none; /* Hide panels by default */
    animation: fadeIn 0.3s ease-in-out; /* Optional fade-in */
}

.config-tab-panel.active {
    display: block; /* Show active panel */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(10px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Apply animation only to context and potential match items, not master list */
.context-item, .potential-match-item {
    animation: fadeIn 0.3s ease-out forwards;
}

.config-tab-panel.active {
    animation: slideIn 0.2s ease-out;
}

/* Collapsed State */
.config-tabs-container.collapsed .config-tab-panels {
    display: none;
}
.config-tabs-container.collapsed {
    /* Reduce bottom margin when collapsed to bring main interface up */
    margin-bottom: 10px;
    /* Optionally set a fixed height or rely on content */
    /* height: auto; */ /* Allow header to determine height */
}
.config-tabs-container.collapsed .config-tabs-header {
    border-bottom: none; /* Remove border when panels are hidden */
}


/* Adjustments for elements moved into tabs */
.config-tab-panel .upload-section,
.config-tab-panel .column-selection-section {
    margin-bottom: 10px;
}
.config-tab-panel label {
    margin-right: 5px;
}
.config-tab-panel input[type="file"],
.config-tab-panel input[type="text"],
.config-tab-panel input[type="number"],
.config-tab-panel select,
.config-tab-panel button {
    padding: 8px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
}
.config-tab-panel button {
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
}
.config-tab-panel button:hover {
    background-color: #0056b3;
}
.config-tab-panel button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}
/* --- shadcn/ui Mimic Styles --- */

/* Utility Classes (Add more as needed) */
.p-4 { padding: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.mr-2 { margin-right: 0.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }
.h-10 { height: 2.5rem; }
.w-10 { width: 2.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-1.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; } /* Removed backslash */
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.whitespace-nowrap { white-space: nowrap; }
.rounded-md { border-radius: var(--radius); }
.rounded-lg { border-radius: calc(var(--radius) + 2px); } /* Slightly larger for containers */
.rounded-sm { border-radius: calc(var(--radius) - 2px); } /* Slightly smaller for inner elements */
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.bg-card { background-color: hsl(var(--card)); }
.text-card-foreground { color: hsl(var(--card-foreground)); }
.bg-background { background-color: hsl(var(--background)); }
.text-foreground { color: hsl(var(--foreground)); }
.bg-primary { background-color: hsl(var(--primary)); }
.text-primary-foreground { color: hsl(var(--primary-foreground)); }
.bg-muted { background-color: hsl(var(--muted)); }
.text-muted-foreground { color: hsl(var(--muted-foreground)); }
.bg-muted/50 { background-color: hsla(var(--muted), 0.5); } /* Removed backslash */
.hover:bg-primary/90:hover { background-color: hsla(var(--primary), 0.9); } /* Removed backslash before : and / */
.hover:bg-accent:hover { background-color: hsl(var(--accent)); } /* Removed backslash */
.hover:text-accent-foreground:hover { color: hsl(var(--accent-foreground)); } /* Removed backslash */
.ring-offset-background { /* Basic ring offset */
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-width) + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.focus-visible\:outline-none:focus-visible { outline: 2px solid transparent; outline-offset: 2px; }
/* Add more focus-visible ring styles if needed */
.disabled\:pointer-events-none:disabled { pointer-events: none; }
.disabled\:opacity-50:disabled { opacity: 0.5; }
.block { display: block; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 768px) { /* md: prefix */
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* Tabs Component Mimic */
.tabs-list {
    /* display: inline-flex; */ /* Handled by utility */
    /* height: 2.5rem; */ /* h-10 */
    /* align-items: center; */ /* Handled by utility */
    /* justify-content: center; */ /* Handled by utility */
    /* border-radius: var(--radius); */ /* rounded-md */
    /* background-color: hsl(var(--muted)); */ /* bg-muted */
    /* padding: 0.25rem; */ /* p-1 */
    /* color: hsl(var(--muted-foreground)); */ /* text-muted-foreground */
}

.tabs-trigger {
    /* display: inline-flex; */ /* Handled by utility */
    /* align-items: center; */ /* Handled by utility */
    /* justify-content: center; */ /* Handled by utility */
    /* white-space: nowrap; */ /* Handled by utility */
    /* border-radius: calc(var(--radius) - 2px); */ /* rounded-sm */
    /* padding: 0.375rem 0.75rem; */ /* px-3 py-1.5 */
    /* font-size: 0.875rem; */ /* text-sm */
    /* font-weight: 500; */ /* font-medium */
    /* ring-offset-background */ /* Handled by utility */
    /* transition-all */ /* Handled by utility */
    /* focus-visible styles */ /* Handled by utility */
    /* disabled styles */ /* Handled by utility */
    cursor: pointer;
    border: none; /* Reset default button border */
    background-color: transparent; /* Default state */
    color: hsl(var(--muted-foreground));
}

.tabs-trigger[data-state="active"] {
    background-color: hsl(var(--background)); /* bg-background */
    color: hsl(var(--foreground)); /* text-foreground */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
}

/* Override hover text color for config tabs (non-active) */
.tabs-trigger:not([data-state="active"]):hover {
    color: hsl(var(--primary-foreground)); /* Use primary-foreground (white) for hover text */
    /* Optionally add a subtle background hover for non-active tabs if desired */
    /* background-color: hsl(var(--muted)); */
}

/* Prevent hover effect on the *active* tab */
.tabs-trigger[data-state="active"]:hover {
    background-color: hsl(var(--background)); /* Keep active background */
    color: hsl(var(--foreground)); /* Keep active text color */
    cursor: default; /* Indicate it's not interactive */
}


.config-tab-panel {
    display: none; /* Hide inactive panels */
    /* Add focus ring styles if needed */
    /* ring-offset-background */
    /* focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 */
}

.config-tab-panel[data-state="active"] {
    display: block; /* Show active panel */
}

/* Button Component Mimic */
.button {
    /* display: inline-flex; */ /* Handled by utility */
    /* align-items: center; */ /* Handled by utility */
    /* justify-content: center; */ /* Handled by utility */
    /* border-radius: var(--radius); */ /* rounded-md */
    /* font-size: 0.875rem; */ /* text-sm */
    /* font-weight: 500; */ /* font-medium */
    /* ring-offset-background */ /* Handled by utility */
    /* transition-colors */ /* Handled by utility */
    /* focus-visible styles */ /* Handled by utility */
    /* disabled styles */ /* Handled by utility */
    cursor: pointer;
    border: none; /* Reset default button border */
    /* Default variant (primary) */
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    /* height: 2.5rem; */ /* h-10 */
    /* padding: 0.5rem 1rem; */ /* px-4 py-2 */
}
.button:hover {
     background-color: hsla(var(--primary), 0.9); /* Mimic hover:bg-primary/90 */
}
/* Add other variants (secondary, destructive, outline, ghost, link) as needed */
.button-ghost { /* Example for close button */
    background-color: transparent;
    color: hsl(var(--foreground)); /* Adjust as needed */
}
.button-ghost:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

/* Override hover text color for config close button */
.config-close-button:hover {
    color: hsl(var(--primary-foreground)); /* Use primary-foreground (white) for hover text */
}


/* Input Component Mimic */
.input {
    /* display: flex; */ /* Handled by utility */
    /* height: 2.5rem; */ /* h-10 */
    /* width: 100%; */ /* w-full */
    /* border-radius: var(--radius); */ /* rounded-md */
    /* border: 1px solid hsl(var(--input)); */ /* border border-input */
    /* background-color: hsl(var(--background)); */ /* bg-background */
    /* padding: 0.5rem 0.75rem; */ /* px-3 py-2 */
    /* font-size: 0.875rem; */ /* text-sm */
    /* ring-offset-background */ /* Handled by utility */
    /* placeholder styles */ /* Handled by utility */
    /* focus-visible styles */ /* Handled by utility */
    /* disabled styles */ /* Handled by utility */
    /* file input specific styles */ /* Handled by utility */
    border-width: 1px; /* Ensure border is visible */
}
.input::placeholder {
    color: hsl(var(--muted-foreground));
}
/* Style file input button text */
.input[type="file"]::file-selector-button {
    border: none;
    padding: 0;
    margin-right: 0.5rem; /* Add some space */
    background: none;
    font-size: 0.875rem; /* text-sm */
    font-weight: 500; /* font-medium */
    color: hsl(var(--primary)); /* Make it look like a link */
    cursor: pointer;
}
.input[type="file"]::file-selector-button:hover {
    text-decoration: underline;
}


/* Label Component Mimic */
.label {
    /* font-size: 0.875rem; */ /* text-sm */
    /* font-weight: 500; */ /* font-medium */
    /* line-height: 1; */ /* leading-none */
    /* peer-disabled styles */ /* Handled by utility */
    /* display: block; */ /* Added utility */
    /* margin-bottom: 0.5rem; */ /* Added utility */
}

/* Select Component Mimic (Basic - Requires JS for custom dropdown) */
.select-container {
    position: relative; /* Needed for absolute positioning of arrow */
}
.select {
    appearance: none; /* Remove default arrow */
    /* display: flex; */ /* Handled by utility */
    /* height: 2.5rem; */ /* h-10 */
    /* width: 100%; */ /* w-full */
    /* align-items: center; */ /* Handled by utility */
    /* justify-content: space-between; */ /* Handled by utility */
    /* border-radius: var(--radius); */ /* rounded-md */
    /* border: 1px solid hsl(var(--input)); */ /* border border-input */
    /* background-color: hsl(var(--background)); */ /* bg-background */
    /* padding: 0.5rem 0.75rem; */ /* px-3 py-2 */
    /* font-size: 0.875rem; */ /* text-sm */
    /* ring-offset-background */ /* Handled by utility */
    /* placeholder styles */ /* Handled by utility */
    /* focus styles */ /* Handled by utility */
    /* disabled styles */ /* Handled by utility */
    border-width: 1px; /* Ensure border is visible */
    padding-right: 2rem; /* Make space for custom arrow */
    cursor: pointer;
}
/* Add custom arrow using pseudo-element */
.select-container::after {
    content: '▼'; /* Simple down arrow */
    position: absolute;
    right: 0.75rem; /* px-3 */
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none; /* Don't interfere with select click */
    color: hsl(var(--muted-foreground));
    font-size: 0.8rem;
}
/* Hide default arrow specifically for IE */
.select::-ms-expand {
    display: none;
}


/* --- End shadcn/ui Mimic Styles --- */


/* Old label style - remove or integrate */
/* label {
    margin-right: 5px;
}

input[type="file"], input[type="text"], input[type="number"], select, button {
    padding: 8px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

button {
    cursor: pointer;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}


.status-message {
    padding: 0.75rem 1rem;
    margin: 0 1.25rem 1rem 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-message:before {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-size: contain;
    background-repeat: no-repeat;
}

.status-message.success {
    background-color: #f0fdf4;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.status-message.success:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23166534'%3E%3Cpath d='M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z' /%3E%3C/svg%3E");
}

.status-message.error {
    background-color: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.status-message.error:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23991b1b'%3E%3Cpath d='M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z' /%3E%3C/svg%3E");
}

.config-area > div {
    margin-bottom: 10px;
}

label {
    margin-right: 5px;
}

input[type="file"], input[type="text"], input[type="number"], select, button {
    padding: 8px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

button {
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}


.status-message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 3px;
}

.status-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.main-interface {
    margin-top: 20px;
}

.pane-container {
    display: flex;
    justify-content: space-between;
    gap: 15px; /* Add space between panes */
}

.pane {
    flex: 1;
    background-color: #fff;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.pane:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.pane h2 {
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    font-size: 1.1em;
}

.item-list {
    border: 1px dashed #eee; /* Visual cue for drop zone */
    min-height: 300px; /* Minimum height for the list area */
    flex-grow: 1; /* Allow list to fill available space in pane */
    padding: 5px;
    overflow-y: auto; /* Add scroll if content overflows */
    background-color: #f9f9f9;
}

/* Style for draggable items */
.list-item {
    background-color: #e9ecef;
    padding: 8px 10px;
    margin-bottom: 5px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    cursor: grab;
    font-size: 0.9em;
}

.list-item:active {
    cursor: grabbing;
}

/* Style for group headers in the middle pane */
.group-header {
    background-color: #d1ecf1;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #bee5eb;
    border-radius: 3px;
    cursor: pointer; /* Indicate it's clickable */
    font-weight: bold;
}

/* Style for AI processing overlay */
.main-interface.ai-processing {
    position: relative; /* Needed for pseudo-element positioning */
    pointer-events: none; /* Disable clicks on the interface itself */
    opacity: 0.7; /* Dim the interface */
}

.main-interface.ai-processing::after {
    content: 'AI Processing... Please Wait';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(200, 200, 200, 0.5); /* Semi-transparent grey overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    z-index: 10; /* Ensure overlay is on top */
    pointer-events: auto; /* Allow interaction with the overlay itself if needed, though not necessary here */
    cursor: wait; /* Indicate busy state */
}
.group-header.selected {
    background-color: #b8daff;
    border-color: #9fcdff;
}

/* Style for variants in the details pane */
.variant-item {
    background-color: #fff;
    padding: 5px 8px;
    margin-bottom: 3px;
    border: 1px solid #eee;
    border-radius: 3px;
    display: flex;
    justify-content: space-between;
    cursor: pointer; /* To select as standardized name */
}
.variant-item .score {
    color: #6c757d;
    font-size: 0.8em;
}


/* SortableJS ghost class (element being dragged) */
.sortable-ghost {
    opacity: 0.4;
    background-color: #cce5ff;
}

/* SortableJS chosen class (element picked up) */
.sortable-chosen {
    background-color: #b8daff;
}

.group-details-section, .save-for-later-section {
    margin-bottom: 15px;
}

.standardized-name-section {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}
.standardized-name-section label {
    margin-right: 5px;
    white-space: nowrap;
}
.standardized-name-section input {
    flex-grow: 1; /* Input takes remaining space */
    margin-right: 5px;
}

hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 15px 0;
}


/* --- START: Styles from previous refactor (ensure they are present) --- */
/* General Styles */
html, body {
    height: 100%; /* Make html and body fill the viewport height */
    overflow: hidden; /* Prevent body scrolling */
    margin: 0; /* Remove default body margin */
    padding: 0; /* Remove default body padding */
}

body {
    font-family: sans-serif;
    /* margin: 20px; */ /* Removed margin */
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    /* min-height: calc(100vh - 40px); */ /* Replaced by height: 100% */
    padding: 20px; /* Add padding inside the body */
    box-sizing: border-box; /* Include padding in height calculation */
}


@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

h1, h2, h3, h4 {
    font-weight: 600;
    color: var(--dark);
    margin-top: 0;
}

h1 {
    font-size: 1.5rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h2:after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%);
    margin-left: 0.5rem;
}

h2 {
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    font-size: 1.1em;
}

button {
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background-color: #007bff;
    color: white;
    border: none;
}
button:hover {
    background-color: #0056b3;
}
button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

input[type="text"], input[type="number"], select {
    padding: 8px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

/* Layout Areas */
.config-area, .output-area {
    background-color: #fff;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0; /* Prevent these areas from shrinking */
}
.config-area > div {
    margin-bottom: 10px;
}
.output-area {
    margin-top: auto; /* Push output area to the bottom if space allows */
}

.status-message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 3px;
    display: none; /* Hidden by default */
    flex-shrink: 0;
}
.status-message.success {
    background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb;
}
.status-message.error {
    background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb;
}

/* Ignore List Area Styles (Now inside tab panel) */
#tabPanelIgnoreTerms label {
    /* margin-right: 5px; */ /* Use default label style */
    font-weight: bold;
}
#tabPanelIgnoreTerms input[type="text"] {
    /* margin-right: 5px; */ /* Use default input style */
    width: 200px; /* Adjust as needed */
}
#tabPanelIgnoreTerms button {
    padding: 6px 10px; /* Slightly smaller button */
}
#tabPanelIgnoreTerms .current-ignore-list {
    margin-top: 8px;
    font-size: 0.9em;
    color: #495057;
}
#tabPanelIgnoreTerms #currentIgnoredTerms {
    font-style: italic;
    word-break: break-all; /* Prevent long lists from overflowing */
}

/* Suggested Ignore Terms Styles (Now inside tab panel) */
#tabPanelIgnoreTerms .suggested-terms-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
    font-size: 0.9em;
    color: #495057;
}
#tabPanelIgnoreTerms .suggested-term {
    display: inline-block;
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    padding: 3px 8px;
    margin: 2px 4px 2px 0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s ease;
}
#tabPanelIgnoreTerms .suggested-term:hover {
    background-color: #b8daff;
    border-color: #9fcdff;
    color: #004085;
}

/* Styles for individual ignored terms */
#tabPanelIgnoreTerms .ignored-term {
    display: inline-block;
    background-color: #e9ecef; /* Light grey background */
    color: #495057;
    border: 1px solid #ced4da;
    padding: 3px 8px;
    margin: 2px 4px 2px 0;
    border-radius: 10px;
    font-size: 0.95em;
    line-height: 1.2; /* Adjust line height */
}

#tabPanelIgnoreTerms .remove-term-button {
    background: none;
    border: none;
    color: #dc3545; /* Red color for remove */
    cursor: pointer;
    font-size: 1.1em; /* Slightly larger 'x' */
    margin-left: 5px;
    padding: 0;
    line-height: 1; /* Align 'x' vertically */
    font-weight: bold;
}

#tabPanelIgnoreTerms .remove-term-button:hover {
    color: #c82333; /* Darker red on hover */
}

/* Style for pending ignore terms */
#tabPanelIgnoreTerms .ignored-term.pending {
    background-color: #f8d7da; /* Light red background */
    border-color: #f5c6cb;
    color: #721c24; /* Darker red text */
}

/* Style for temporary flash effect after applying */
#tabPanelIgnoreTerms .ignored-term.applied-flash {
    background-color: #d4edda; /* Light green background */
    border-color: #c3e6cb;
    color: #155724; /* Darker green text */
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out, color 0.3s ease-in-out;
}


/* Output Area Styles (Now inside tab panel) */
#tabPanelGenerateOutput h2 {
    /* Use default h2 style */
    font-size: 1.1em; /* Example override if needed */
}
#tabPanelGenerateOutput label {
    margin-right: 5px;
}
#tabPanelGenerateOutput select {
    margin-right: 10px;
}
#tabPanelGenerateOutput input[type="text"] {
    margin-right: 10px;
}


/* Main Interface */
.main-interface {
    margin: 0 20px 20px 20px; /* Align with tabs */
    flex-grow: 1; /* Allow interface to fill remaining vertical space */
    display: flex; /* Use flexbox for the interface itself */
    /* min-height: 450px; */ /* Remove fixed min-height, let flexbox handle it */
    overflow: hidden; /* Prevent interface itself from overflowing */
}

.pane-container {
    display: flex;
    flex-grow: 1; /* Allow container to fill the main-interface area */
    gap: 15px;
    /* height: 100%; */ /* REMOVED - Let flexbox determine height based on parent */
}

.pane {
    flex: 1; /* Each pane takes equal width */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column; /* Stack title, controls, list vertically */
    /* overflow: hidden; */ /* Removed: Let inner .item-list handle scrolling */
}

/* Item Lists within Panes */
.item-list {
    flex-grow: 1; /* Allow list to fill available space in pane */
    overflow-y: auto; /* Add scroll if content overflows */
    border: 1px solid #eee;
    padding: 5px;
    background-color: #f9f9f9;
    /* min-height: 100px; */ /* Remove min-height, let flex handle it */
}

/* Master List Specifics */
.master-list-pane .list-controls {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.master-list-pane input[type="text"] {
    width: calc(100% - 20px); /* Adjust width considering padding */
    margin-right: 0;
}

.master-item {
    padding: 6px 8px;
    margin-bottom: 4px;
    border: 1px solid transparent; /* For selection border */
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid #eee;
    user-select: none; /* Prevent text selection */
}
.master-item:hover {
    background-color: #e9ecef;
}
.master-item.selected {
    background-color: #cce5ff;
    border-color: #9fcdff;
    font-weight: bold;
}
.master-item .item-icon {
    margin-right: 8px;
    font-size: 1.1em;
    width: 20px; /* Align names */
    display: inline-block;
    text-align: center;
}
.master-item .item-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Container for indicators */
.indicators-container {
    display: flex;
    align-items: center;
    margin-left: 5px; /* Space between name and indicators */
}

/* Base style for indicators */
.indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%; /* Make it a circle */
    margin-left: 3px; /* Space between multiple indicators */
    flex-shrink: 0; /* Prevent shrinking */
}

/* Specific indicator colors */
.indicator-user {
    background-color: #198754; /* Dark Green */
}
.indicator-ai {
    background-color: #a3e9a4; /* Light Green */
    border: 1px solid #8fdc8f; /* Optional subtle border for light color */
}
.indicator-match {
    background-color: #ffc107; /* Yellow */
}


/* Context Pane Specifics */
.context-header {
    padding: 10px;
    background-color: #e2e3e5;
    border-radius: 3px;
    margin-bottom: 10px;
    font-size: 0.95em;
    color: #495057;
    min-height: 1.5em; /* Prevent jumping when text appears */
    border: 1px solid #d6d8db;
    /* position: sticky; */ /* REMOVED - Pane doesn't scroll */
    /* top: 0; */ /* REMOVED */
    /* background-color: #fff; */ /* Use default header background */
    /* z-index: 1; */ /* REMOVED */
}
.context-header h3 {
    margin: 0;
    font-size: 1em;
    font-weight: normal;
}
.context-header #standardizedNameDisplay {
    font-weight: bold;
    color: #333;
}
.sync-error-message { /* Style for sync error */
    color: orange;
    font-size: 0.8em;
    margin-top: 5px;
}


.context-item {
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    border: 1px solid #eee;
}
.context-item .item-name {
    flex-grow: 1;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none; /* Prevent text selection */
}
.context-item .item-name.clickable-name {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: #007bff;
    user-select: text; /* Allow selecting standard name */
}
.context-item .item-name.clickable-name:hover {
    color: #0056b3;
}

/* Style for ignored items in context pane */
.context-item.ignored-for-standard .item-name {
    text-decoration: line-through;
    color: #6c757d; /* Grey out text */
    cursor: not-allowed; /* Indicate non-clickable */
}
.context-item.ignored-for-standard .item-name.clickable-name {
    /* Override clickable styles when ignored */
    text-decoration: line-through; /* Keep strikethrough */
    text-decoration-color: #6c757d; /* Match text color */
    cursor: not-allowed;
}
.context-item.ignored-for-standard .item-name.clickable-name:hover {
    /* Prevent hover effect when ignored */
    color: #6c757d;
}


/* Container for action buttons */
.context-item .item-actions {
    display: flex;
    align-items: center;
    gap: 5px; /* Space between buttons */
}

/* Action Buttons (general) */
.action-button {
    padding: 2px 6px; /* Smaller buttons */
    font-size: 0.9em;
    line-height: 1;
    min-width: 25px; /* Ensure button has some width */
}
.ungroup-button {
    background-color: #dc3545; /* Red for removal */
    border-color: #dc3545;
}
.ungroup-button:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Ignore Item Button */
.ignore-item-button {
    background-color: #ffc107; /* Amber/yellow */
    border-color: #ffc107;
    color: #212529; /* Dark text for contrast */
}
.ignore-item-button:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}
/* Style for "Unignore" state */
.context-item.ignored-for-standard .ignore-item-button {
    background-color: #6c757d; /* Grey when ignored */
    border-color: #6c757d;
    color: white;
}
.context-item.ignored-for-standard .ignore-item-button:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* Placeholder for alignment */
.action-placeholder {
    display: inline-block;
    /* Adjust width to roughly match the ignore button's typical size */
    /* Needs experimentation, depends on button text/padding */
    min-width: 60px; /* Start with a guess */
    text-align: center; /* Center content if any */
    /* height: 10px; */ /* Minimal height */
    /* margin: 0 2px; */ /* Match button padding/margin roughly */
}


/* Solo item specific styling */
.solo-item .item-name {
    font-style: italic;
    /* Ensure solo items don't get strikethrough if somehow marked ignored */
    text-decoration: none;
    color: inherit;
    cursor: default;
}
.solo-item .solo-message {
    color: #6c757d;
    font-size: 0.9em;
    margin-left: 5px;
}
/* --- END: Styles from previous refactor --- */

/* Tab Navigation Styles */
.tab-container {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 1px solid #ccc;
}

.tab-button {
    padding: 8px 15px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    background-color: #eee;
    color: #333;
    border-radius: 4px 4px 0 0;
    margin-right: 5px;
    font-size: 0.9em;
    position: relative; /* For positioning count */
    bottom: -1px; /* Align with bottom border */
    transition: background-color 0.2s ease;
}

.tab-button:hover {
    background-color: #ddd;
}

.tab-button.active {
    background-color: #fff;
    border-color: #ccc;
    border-bottom-color: #fff; /* Hide bottom border part */
    font-weight: bold;
    color: #007bff;
}

.tab-count {
    font-weight: normal;
    color: #555;
}
.tab-button.active .tab-count {
    color: #007bff;
}


/* Adjust Master List Filter Input */
.master-list-pane .list-controls input[type="text"] {
    margin-top: 5px; /* Add some space below tabs */
}


/* --- START: Styles for Potential Matches Pane --- */
.potential-matches-pane .item-list {
    /* Inherits base item-list styles */
     background-color: #fdfdfd; /* Slightly different background */
}

.potential-matches-pane .placeholder-message {
    padding: 15px;
    color: #6c757d;
    font-style: italic;
    text-align: center;
}

/* Make Potential Matches header sticky */
.potential-matches-pane h2 {
    /* position: sticky; */ /* REMOVED - Pane doesn't scroll */
    /* top: 0; */ /* REMOVED */
    /* background-color: #fff; */ /* Use default pane background */
    /* z-index: 1; */ /* REMOVED */
    /* Existing h2 styles are preserved */
}


.potential-match-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.potential-match-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.potential-match-section h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 0.95em;
    color: #495057;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 3px;
}

.potential-match-item {
    padding: 5px 8px;
    margin-bottom: 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    border: 1px solid #eee;
    font-size: 0.9em;
}
.potential-match-item .item-name {
    flex-grow: 1;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.add-to-group-button {
    background-color: #28a745; /* Green for add */
    border-color: #28a745;
    color: white;
    font-weight: bold;
}
.add-to-group-button:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Styling for the new group display in potential matches */
.potential-match-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px; /* Space between header and member list */
}
.potential-match-group-header h4 {
    margin: 0; /* Reset margin for h4 inside flex */
    font-size: 0.95em; /* Match section header */
    color: #333; /* Darker color for group name */
    border-bottom: none; /* Remove default border */
    padding-bottom: 0;
}
.potential-match-group-header .add-group-button {
    /* Inherits .action-button and .add-to-group-button styles */
    /* Add specific overrides if needed */
    padding: 3px 8px; /* Slightly larger than ungroup */
}

.potential-match-group-members {
    padding-left: 15px; /* Indent member list */
    font-size: 0.85em; /* Smaller font for members */
    color: #555;
    max-height: 100px; /* Limit height and add scroll if needed */
    overflow-y: auto;
    border-left: 2px solid #eee; /* Visual indicator */
    margin-bottom: 10px; /* Space below member list */
}

.potential-match-member-item {
    display: block; /* Each member on its own line */
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Style for previously standard item in context pane */
.context-item.previous-standard {
    background-color: #fff3cd; /* Light yellow background */
    border-left: 3px solid #ffeeba; /* Yellow left border */
}
.context-item.previous-standard .item-name {
    /* Optional: slightly bolder or different color */
    /* font-weight: 500; */
}

/* Style for the current standard item in context pane */
.context-item.current-standard {
    background-color: #d4edda; /* Light green background */
    border-left: 3px solid #c3e6cb; /* Green left border */
    font-weight: bold; /* Make the standard name bold */
}
.context-item.current-standard .item-name {
    /* Ensure clickable style doesn't override boldness */
    font-weight: bold;
}


/* Alert Component Mimic */
.alert {
    position: relative;
    /* width: 100%; */ /* Handled by utility */
    /* border-radius: var(--radius); */ /* rounded-lg */
    /* border: 1px solid hsl(var(--border)); */ /* border */
    /* padding: 1rem; */ /* p-4 */
    /* Add other base styles if needed */
    border-width: 1px; /* Ensure border is visible */

    /* --- Fixed Bottom Alert Styles --- */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100; /* Ensure it's above other content */
    margin: 0; /* Remove any potential margins */
    border-radius: 0; /* Remove rounding for full width */
    border-left: none; /* Remove side borders */
    border-right: none;
    border-bottom: none; /* Remove bottom border */
    /* Keep top border */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1); /* Optional shadow */
}
.alert-description {
    /* font-size: 0.875rem; */ /* text-sm */
    /* Adjust line height if needed */
    /* [&_p]:leading-relaxed - Complex selector, maybe just set line-height */
    line-height: 1.625;
}
/* Alert Variants */
.alert-success { /* Custom class name */
    background-color: hsl(145, 63%, 96%); /* Light green */
    border-color: hsl(145, 63%, 86%);
    color: hsl(145, 63%, 30%);
}
.alert-error { /* Custom class name */
    background-color: hsl(0, 84%, 97%); /* Light red */
    border-color: hsl(0, 84%, 91%);
    color: hsl(0, 72%, 51%);
}
.alert-info { /* Custom class name */
    background-color: hsl(210, 40%, 98%); /* Light gray/blue */
    border-color: hsl(210, 40%, 91%);
    color: hsl(215, 20%, 45%);
}

/* Style for the keyboard shortcut badge on potential matches */
.match-shortcut-badge {
    display: inline-flex; /* Use inline-flex for centering */
    align-items: center;
    justify-content: center;
    width: 1.4em; /* Adjust size as needed */
    height: 1.4em;
    background-color: #343a40; /* Dark background */
    color: #fff; /* White text */
    border-radius: 50%; /* Make it round */
    font-size: 0.8em; /* Smaller font size for the number */
    font-weight: bold;
    margin-right: 8px; /* Space between badge and group name */
    flex-shrink: 0; /* Prevent shrinking */
    line-height: 1; /* Ensure text is centered vertically */
}


/* --- END: Styles for Potential Matches Pane --- */
