/* PactAlign Shared Theme - High-End Editorial Legal Aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #0B2030;
    --primary-hover: #16364d;
    --accent-color: #2e7d32;
    --warning-color: #f57c00;
    --danger-color: #D91636;
    
    --bg-page: #F7F5F0;        /* Parchment */
    --bg-primary: #ffffff;
    --bg-secondary: #f9f8f4;
    --bg-tertiary: #EDE9DF;    /* Ink/Parchment mix */
    
    --border-color: #DCD9D0;
    --text-primary: #0B2030;   /* Oxford Blue */
    --text-secondary: #4A5568;
    --text-muted: #718096;
    
    /* Clause Status Colors */
    --keep-color: #2e7d32;
    --replace-color: #ef6c00;
    --modify-color: #1976d2;
    --skip-color: #718096;
    
    --radius: 14px;
    --radius-sm: 8px;
    --radius-lg: 18px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

/* --- Foundational Layout --- */
.container { 
    max-width: 1240px; 
    margin: 0 auto; 
    padding: 0 var(--space-md); 
    width: 100%; 
    box-sizing: border-box; 
}

#header { 
    background: var(--bg-primary); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius); 
    padding: 4px 16px; 
    box-shadow: var(--shadow); 
    margin-top: 4px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    transition: all 0.3s ease;
}

#header-left { display: flex; align-items: center; gap: var(--space-md); }
#header-left img { height: 30px; width: auto; object-fit: contain; }
#header-left #university-name { font-size: 14px; color: var(--text-primary); font-weight: 600; line-height: 1.2; }

#header-right { text-align: right; display: flex; align-items: center; gap: var(--space-lg); }
#header-right h1 { margin: 0; font-size: 20px; color: var(--text-primary); font-weight: 700; letter-spacing: -0.025em; }

#main-content { 
    display: flex; 
    flex: 1; 
    gap: var(--space-lg); 
    margin: 8px 0; 
    align-items: flex-start; 
}

#chat-column { flex: 1; min-width: 0; }

#sidebar { 
    width: 450px; 
    background: var(--bg-primary); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius); 
    box-shadow: var(--shadow); 
    display: none; 
    flex-direction: column; 
    flex-shrink: 0;
}

#chat { 
    display: none; 
    background: var(--bg-primary); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius); 
    padding: var(--space-lg); 
    box-shadow: var(--shadow); 
    margin-bottom: var(--space-lg); 
}

/* Message Bubbles */
.msg { margin: var(--space-md) 0; padding: var(--space-md); border-radius: var(--radius-sm); font-size: 14px; transition: all 0.2s ease; }
.user { background: #eef2ff; border-right: 4px solid var(--primary-color); text-align: left; margin-left: var(--space-xl); }
.assistant { background: var(--bg-primary); border: 1px solid var(--border-color); border-left: 4px solid var(--secondary-color, var(--accent-color)); margin-right: var(--space-xl); }

.msg-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.msg-timestamp {
    font-size: 9px; /* Very small font */
    color: var(--text-muted, #718096);
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    opacity: 0.75;
}

.msg-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted, #718096);
    opacity: 0.5;
    transition: all 0.2s ease;
    padding: 2px;
    border-radius: var(--radius-sm);
}

.msg-copy-btn:hover {
    opacity: 1;
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.msg-copy-btn svg {
    width: 10px !important;
    height: 10px !important;
    display: block;
}

/* Sidebar Layouts */
#right-sidebar {
    width: 380px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}
#right-sidebar.active { display: flex; }

#right-sidebar-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

#right-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

body > .container {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-top: 0;
}

/* Header & User Menu Buttons */
.user-btn {
    padding: 8px 18px;
    font-weight: 700;
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(11, 32, 48, 0.1);
}

.user-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 32, 48, 0.2);
}

.user-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.user-btn.secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

/* Reusable Diagnostic Loader & Animations */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(11, 32, 48, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-sizing: border-box;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.diagnostic-loader, #thinking {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    width: fit-content;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

#thinking {
    padding: 12px 20px;
    margin: 10px var(--space-xl) 10px 0; /* Align with assistant message bubble margins */
    border-left: 4px solid var(--secondary-color, var(--accent-color)) !important;
    background: var(--bg-primary) !important;
}

.diagnostic-loader .loader-text, #thinking-text {
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 10px;
}

.diagnostic-loader .loader-timer, #thinking-timer {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-weight: 500;
    color: var(--primary-color);
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 3px;
    min-width: 38px;
    text-align: center;
    font-size: 11px;
}

/* Premium Components */

.premium-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-lg);
}

.editorial-header {
    margin-bottom: var(--space-xl);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: var(--space-md);
}

.editorial-header h1 {
    font-size: 32px;
    margin-bottom: var(--space-xs);
}

.editorial-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

/* Form Elements */

input, select, textarea {
    font-family: 'Montserrat', sans-serif;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(11, 32, 48, 0.05);
}

button, .btn {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e5e0d3;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    border: none;
}

button:disabled, .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

/* Badges */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-blue { background: #eef2ff; color: #4338ca; }
.badge-green { background: #f0fdf4; color: #15803d; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-red { background: #fef2f2; color: #b91c1c; }

/* Table Styling */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: var(--space-md);
    background: var(--bg-secondary);
    font-family: 'Fraunces', serif;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-tertiary);
}

/* Lucide Icon Alignment */
[data-lucide] {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
    vertical-align: middle;
}

/* Pagination Controls */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
}

.pagination-stats {
    font-size: 11px;
    color: var(--text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
}

.pagination-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
    transition: all 0.2s ease;
    min-width: 28px;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-tertiary);
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#global-input-container {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 10;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 6px 10px; /* Compact padding / minimal border spacing */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    opacity: 0.96;
    transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Contextual Minimization for Review/Generate Tabs */
#global-input-container.contextual-minimized {
    max-width: none;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
}

/* Drag and Drop Active State */
#global-input-container.drag-over {
    max-width: none !important;
    opacity: 1 !important;
    background: var(--bg-secondary) !important;
    border: 2px dashed var(--primary-color) !important;
    box-shadow: 
        0 10px 25px rgba(11, 32, 48, 0.1),
        0 16px 40px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-2px) !important;
}

#global-input-container:hover,
#global-input-container:focus-within,
#global-input-container.contextual-minimized:hover,
#global-input-container.contextual-minimized:focus-within {
    max-width: none; /* Auto-constrained within drawer boundaries */
    opacity: 1;
    background: var(--bg-primary);
    transform: translateY(-2px);
    padding: 10px 12px 8px 12px; /* Snug active padding to avoid vertical bloat */
    box-shadow: 
        0 10px 25px rgba(11, 32, 48, 0.1),
        0 16px 40px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

#global-input-wrapper {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px; /* Tighter item gap */
    align-items: center;
    width: 100%;
    position: relative;
}

.input-caret {
    position: absolute;
    left: 10px; /* aligns exactly with input vertical padding offset */
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color, #C4820E);
    font-family: inherit;
    font-weight: 300 !important;
    font-size: 16px;
    pointer-events: none;
    z-index: 5;
    animation: caret-blink 0.8s step-start infinite;
    display: none;
}

@keyframes caret-blink {
    50% { opacity: 0; }
}

#global-input-container input[type="text"]#input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    outline: none !important; /* Prevent default browser focus outline */
    font-size: 14px; /* Crisp font-size */
    padding: 6px 0 6px 10px !important; /* Extremely compact vertical padding with 10px left indent */
    color: var(--text-primary);
    box-shadow: none !important;
    width: auto !important;
    min-width: 0;
}

#global-input-container .paperclip-label {
    background: var(--bg-secondary);
    width: 30px; /* Snug matching width */
    height: 30px; /* Snug matching height */
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#global-input-container .paperclip-label:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

#global-input-container button#send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 14px; /* Cozy, extremely snug padding matching paperclip height */
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px; /* Slightly smaller crisper font */
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(11, 32, 48, 0.15);
}

#global-input-container button#send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

#chat-file-indicator {
    background: var(--bg-secondary);
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

#quick-prompts, #quick-prompts-review {
    padding: 0 5px;
    margin-bottom: 0 !important;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}



.prompt-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.prompt-chip.needs-attachment {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.2);
}

.prompt-chip.freeform {
    background: rgba(76, 175, 80, 0.08);
    border-color: rgba(76, 175, 80, 0.2);
}

.prompt-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.prompt-chip [data-lucide] {
    width: 12px;
    height: 12px;
    margin-right: 4px;
    opacity: 0.7;
}

/* Ensure content doesn't get hidden behind the floating bar */
#main-content {
    padding-bottom: 0px !important;
}

#messages {
    padding-bottom: 150px !important;
    box-sizing: border-box;
}

#admin-panel {
    height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
    padding-bottom: 40px;
    box-sizing: border-box;
}

/* --- Consolidated Dashboard Styles --- */

.modal-overlay, #login-modal, #disclaimer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active, #login-modal.active, #disclaimer-modal.active {
    display: flex;
}

.modal-content, .disclaimer-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: var(--space-xl);
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Accordion Styling */
.accordion-header {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--space-md);
    width: 100%;
    border: 1px solid var(--border-color);
    text-align: left;
    outline: none;
    font-size: 16px;
    font-weight: 600;
    transition: 0.3s;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    align-items: center;
    margin-bottom: 5px;
}

.accordion-header:hover { background-color: var(--bg-secondary); }
.accordion-header.active {
    background-color: var(--bg-secondary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
    margin-bottom: 0;
}

.accordion-content {
    padding: 0 var(--space-lg);
    background-color: var(--bg-primary); 
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    margin-bottom: 15px;
}

/* Risk Badges & Clause Cards */
.risk-count {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--shadow);
}

.risk-count.high { background: #fef2f2; color: #991b1b; }
.risk-count.medium { background: #fff7ed; color: #92400e; }
.risk-count.low { background: #f0fdf4; color: #15803d; }

.clause-card {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.clause-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    background: var(--bg-primary);
}

.clause-high-risk { border-left-color: var(--danger-color); }
.clause-medium-risk { border-left-color: var(--warning-color); }
.clause-low-risk { border-left-color: var(--keep-color); }

/* Generate Step Styles */
.generate-step {
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-lg);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.field-row.single { grid-template-columns: 1fr; }

/* Disclaimer Specifics */
.disclaimer-text {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: var(--space-md);
    margin: var(--space-md) 0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.6;
    color: #92400e;
    overflow-y: auto;
}
/* Document List & Items */
.doc-list {
    list-style: none;
    padding: 0;
}

.doc-list li {
    padding: 10px;
    background: var(--bg-secondary);
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-item {
    padding: 12px;
    background: var(--bg-secondary);
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.doc-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Category Badges */
.doc-category {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 70px;
    text-align: center;
}

.category-template { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.category-policy { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; }
.category-guideline { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: white; }
.category-user_upload { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); color: white; }

.doc-info { flex: 1; min-width: 0; }
.doc-filename {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

/* Clause Editor Modal */
.ce-modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:10000; justify-content:center; align-items:flex-start; padding-top:40px; overflow-y:auto; }
.ce-modal-overlay.active { display:flex; }
.ce-modal-content { background: var(--bg-primary); border: 1px solid var(--border-color); border-radius:10px; width:95%; max-width:800px; padding:24px; box-shadow:0 4px 20px rgba(0,0,0,0.3); margin-bottom:40px; }
.ce-modal-content h3 { margin-top:0; color: var(--text-primary); border-bottom:2px solid var(--primary-color); padding-bottom:10px; }
.ce-field { margin-bottom:14px; }
.ce-field label { display:block; font-size:12px; color: var(--text-secondary); margin-bottom:4px; font-weight:600; }
.ce-field input, .ce-field select, .ce-field textarea { width:100%; padding:8px 10px; border: 1px solid var(--border-color); border-radius:4px; font-size:13px; box-sizing:border-box; }
.ce-field textarea { min-height:80px; resize:vertical; font-family:inherit; }
.ce-table { width:100%; border-collapse:collapse; font-size:12px; }
.ce-table th { background: var(--primary-color); color:white; padding:8px 10px; text-align:left; font-size:11px; position:sticky; top:0; }
.ce-table td { padding:8px 10px; border-bottom: 1px solid var(--border-color); vertical-align:top; max-width:250px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ce-table tr:hover { background: var(--bg-secondary); }
.ce-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }
.ce-badge-accept { background:#e8f5e9; color:#2e7d32; }
.ce-badge-reject { background: var(--bg-secondary); color:#c62828; }
.ce-badge-revise { background: var(--bg-secondary); color:#e65100; }
.ce-badge-high { background: var(--bg-secondary); color:#c62828; }
.ce-badge-medium { background: var(--bg-secondary); color:#e65100; }
.ce-badge-low { background:#e8f5e9; color:#2e7d32; }
/* --- Admin & Dashboard Panels --- */
#admin-panel {
    display: none;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow);
}

#admin-panel.active,
#agreement-review-panel.active,
.clause-analysis-panel.active {
    display: block !important;
}

/* Tab Navigation Refinement */
#input-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: var(--space-lg);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(11, 32, 48, 0.15);
}

/* Specific Dashboard Header Fix */
#dashboard-title {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
}

/* Modal Content Hardening */
.modal-content h3 {
    margin-top: 0;
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: var(--space-lg);
}

/* Agreement History Filters */
#history-type-filter, #history-search {
    padding: 12px;
    border-radius: var(--radius-sm);
}

.welcome-liner {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -45%) scale(1.02);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    width: 90%;
    max-width: 500px;
    pointer-events: auto !important;
    z-index: 10;
    filter: blur(4px);
}

.welcome-liner.visible {
    opacity: 1;
    transform: translate(-50%, -45%) scale(1);
    filter: blur(0);
}

.welcome-liner.fade-out {
    opacity: 0;
    transform: translate(-50%, -47%) scale(0.98);
    filter: blur(8px);
    pointer-events: none !important;
}

@keyframes welcome-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes scrollCredits {
    0% {
        transform: translateY(280px);
    }
    100% {
        transform: translateY(-100%);
    }
}


#quick-prompts, #quick-prompts-review {
    padding: 2px 5px;
    margin-bottom: 12px !important;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-height: 300px;
    opacity: 1;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

#footer {
    position: fixed;
    bottom: 5px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    z-index: 100;
}

/* ==========================================================================
   UNIFIED WORKSPACE SPLIT-PANE IDE STYLES
   ========================================================================== */

/* Segmented Control Workflow Navigation */
.workflow-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.workflow-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--text-primary) !important;
}

/* Copilot Tab buttons styling */
.copilot-tab-btn {
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}
.copilot-tab-btn:hover:not(.active):not([disabled]) {
    color: var(--text-primary) !important;
    background: rgba(0, 0, 0, 0.02) !important;
}
.copilot-tab-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed !important;
}

/* Redlined Document Visual Polish */
#agreement-review-panel {
    border-left: 4px solid var(--primary-color);
}

.clauses-container {
    max-height: none;
    overflow-y: visible;
    padding-right: 8px;
}

/* Approved Suggestion Cards Inside Copilot Inspector */
.suggestion-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.suggestion-card:hover {
    border-color: var(--primary-color) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}
.suggestion-card.selected {
    border-color: var(--keep-color) !important;
    background: rgba(16, 185, 129, 0.02) !important;
}

/* Auto-fill summary panels */
#generate-steps h3 {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* Drag and drop active states */
#chat-column.drag-over-canvas {
    outline: 2px dashed var(--accent-color, #10b981) !important;
    outline-offset: -4px;
    border-radius: var(--radius, 12px);
    transition: outline 0.15s ease;
}

#global-input-container.drag-over {
    border: 2px dashed var(--primary-color) !important;
    background: var(--bg-secondary) !important;
}

#load-older-btn:hover {
    background: var(--bg-secondary) !important;
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.landing-workflow-card {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.landing-workflow-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color) !important;
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
    background: var(--bg-primary) !important;
}

/* Day dividers with premium horizontal rules */
.chat-day-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 28px 0 16px 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: 'Montserrat', sans-serif;
}
.chat-day-divider::before, .chat-day-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}
.chat-day-divider::before { margin-right: 16px; }
.chat-day-divider::after { margin-left: 16px; }
.chat-day-divider span {
    background: var(--bg-page);
    padding: 4px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

/* Premium styled delete action button */
.delete-btn {
    background: rgba(217, 22, 54, 0.04) !important;
    color: var(--danger-color) !important;
    border: 1px solid rgba(217, 22, 54, 0.12) !important;
    padding: 6px 14px !important;
    font-size: 11px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700 !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}
.delete-btn:hover {
    background: var(--danger-color) !important;
    color: white !important;
    border-color: var(--danger-color) !important;
    box-shadow: 0 2px 6px rgba(217, 22, 54, 0.15) !important;
}

/* Premium styled edit action button */
.edit-btn {
    background: rgba(0, 50, 98, 0.04) !important;
    color: var(--primary-color) !important;
    border: 1px solid rgba(0, 50, 98, 0.12) !important;
    padding: 6px 14px !important;
    font-size: 11px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700 !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}
.edit-btn:hover {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 2px 6px rgba(0, 50, 98, 0.15) !important;
}

/* Premium Understated Base Button */
.btn-premium {
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    height: 37px !important;
    padding: 8px 20px !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}
.btn-premium:hover {
    background: var(--bg-tertiary) !important;
    border-color: var(--text-secondary) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
}

/* Premium Primary Call-To-Action (distinguished with elegant Gold Accent border) */
.btn-premium-primary {
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    height: 37px !important;
    padding: 8px 20px !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid #C4820E !important;
    border-radius: 6px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}
.btn-premium-primary:hover {
    background: var(--bg-tertiary) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 2px 8px rgba(196, 130, 14, 0.08) !important;
}

/* Premium Form Group Layout */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    width: 100%;
}

.form-group label {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
}
