/**
 * 8Dweb Contract Manager
 *
 * @file        components.css
 * @description Component styles for cards, buttons, forms, and page layouts
 * @author      8Dweb - Matthew J. Sine
 * @ai          Built with AI assistance (Claude, Anthropic)
 * @version     2.9.12.7
 * @revised     2026-02-25
 */

/* ============================================================
   Contract Manager — Components & Page Styles
   Consolidated from 15 PHP view files
   All inline <style> blocks extracted and centralized
   ============================================================ */

/* ---- ROOT VARIABLES ---- */
:root {
    --card-shadow: var(--shadow);
    --border-radius: 8px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --exhibit-primary: var(--primary);
    --exhibit-success: var(--success);
    --exhibit-warning: var(--warning);
    --exhibit-danger: var(--danger);
    --exhibit-info: var(--info);
    --exhibit-secondary: var(--text-secondary);
    --exhibit-dark: var(--text);
}

/* ========== CARD COMPONENTS ========== */

.modern-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.modern-card:hover {
    transform: none;
    box-shadow: var(--card-shadow);
}

.modern-card-header {
    background: var(--bg-inset);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    border: none;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.modern-card-header h5 {
    color: var(--text);
}

.modern-card-header small {
    color: var(--text-muted);
}

.modern-card-body {
    padding: 2rem;
}

.financial-summary-card {
    background: var(--bg-card);
    color: var(--text);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

/* ========== SECTION HEADERS & CONTAINERS ========== */

.section-header {
    color: var(--text);
    border-radius: 0;
    padding: 0;
    margin: 0 0 1.5rem 0;
    position: relative;
    overflow: visible;
    background: transparent;
    border: none;
}

.section-header h5 {
    color: var(--text);
    margin: 0;
}

.section-header small {
    color: var(--text-muted);
}

.pricing-section {
    background: var(--bg-card);
    border-left: none;
    border: 1px solid var(--border);
}

.pricing-section .section-header {
    background: transparent;
    color: var(--text);
}

.pricing-section .component-row {
    border-color: var(--border);
}

.pricing-section .component-row:hover {
    border-color: var(--border);
    box-shadow: var(--card-shadow);
}

.pricing-section .form-control:focus,
.pricing-section .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.25);
    transform: none;
    outline: none;
}

.cost-section {
    background: var(--bg-card);
    border-left: none;
    border: 1px solid var(--border);
}

.cost-section .section-header {
    background: transparent;
    color: var(--text);
}

.cost-section .component-row {
    border-color: var(--border);
}

.cost-section .component-row:hover {
    border-color: var(--border);
    box-shadow: var(--card-shadow);
}

.cost-section .form-control:focus,
.cost-section .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.25);
    transform: none;
    outline: none;
}

.status-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.status-section .form-control:focus,
.status-section .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.25);
    transform: none;
    outline: none;
}

.version-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.version-section .form-control:focus,
.version-section .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.25);
    transform: none;
    outline: none;
}

.content-section {
    background: var(--bg-card);
    border-left: none;
}

.content-section .section-header {
    background: transparent;
    color: var(--text);
}

.content-section .form-control:focus,
.content-section .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.25);
    transform: none;
    outline: none;
}

.variables-section {
    background: var(--bg-card);
    border-left: none;
}

.variables-section .section-header {
    background: transparent;
    color: var(--text);
}

.exhibits-section {
    background: var(--bg-card);
    border-left: none;
}

.exhibits-section .section-header {
    background: transparent;
    color: var(--text);
}

/* ========== FORM CONTROLS ========== */

.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: var(--transition-smooth);
    font-weight: 500;
    padding: 0.75rem;
    background: var(--bg-inset);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.15);
    transform: none;
    outline: none;
}

.form-label {
    color: var(--text);
}

.form-text {
    color: var(--text-muted);
}

.form-floating > label {
    color: var(--text-muted);
}

.is-invalid {
    border-color: var(--danger);
}

.validation-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

/* ========== BUTTONS ========== */

.btn-add-component,
.btn-add-cost {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 1rem 2rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.btn-add-component:hover,
.btn-add-cost:hover {
    transform: none;
    box-shadow: var(--card-shadow);
    color: white;
    background: var(--primary);
    opacity: 0.9;
}

.btn-delete {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.btn-delete:hover {
    transform: none;
    box-shadow: var(--card-shadow);
    background: var(--primary);
    opacity: 0.9;
}

.btn-create {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    box-shadow: var(--card-shadow);
}

.btn-create:hover {
    transform: none;
    box-shadow: var(--card-shadow);
    color: white;
    background: var(--primary);
    opacity: 0.9;
}

.btn-save {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.btn-save:hover {
    transform: none;
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.4);
    color: white;
}

.btn-login {
    background: var(--primary);
    border: none;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    width: 100%;
    color: var(--text-on-primary);
    transition: all 150ms ease;
}

.btn-login:hover {
    background: var(--primary-dark);
    color: var(--text-on-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--primary);
    border: none;
}

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

.btn-group .btn {
    position: relative;
    z-index: 10;
    margin-right: 2px;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* ========== ALERTS ========== */

.alert {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    background: var(--bg-inset);
    color: var(--text);
}

.alert-danger {
    background: var(--bg-inset);
    border-color: var(--border);
    color: var(--text);
}

.alert-info {
    background: var(--bg-inset);
    border-color: var(--border);
    color: var(--text);
}

/* ========== ROWS & CARDS ========== */

.variable-row {
    background: var(--bg-inset);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
}

.exhibit-row {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.exhibit-row:hover {
    border-color: var(--border);
    box-shadow: var(--card-shadow);
}

.component-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.component-counter .badge {
    margin-left: 0.5rem;
}

.financial-section {
    transition: var(--transition-smooth);
    background: var(--bg-inset) !important;
    border-left: none !important;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* ========== FINANCIAL DISPLAYS ========== */

.value-display-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.value-display {
    color: var(--primary);
    font-weight: 800;
    font-size: 2rem;
}

.value-confidence-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.value-confidence-high {
    background-color: var(--bg-inset);
    color: var(--success);
    border: 1px solid var(--border);
}

.value-confidence-medium {
    background-color: var(--bg-inset);
    color: var(--warning);
    border: 1px solid var(--border);
}

.value-confidence-low {
    background-color: var(--bg-inset);
    color: var(--danger);
    border: 1px solid var(--border);
}

.value-breakdown-summary {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

.quick-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quick-stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-inset);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.quick-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.quick-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.profit-section {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.profit-display {
    text-align: center;
    margin-bottom: 1.5rem;
}

.profit-amount {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.profit-margin-badge {
    background: var(--bg-inset);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
    border: 1px solid var(--border);
}

.financial-breakdown {
    font-size: 0.9rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.breakdown-item:last-of-type {
    border-bottom: none;
}

.breakdown-item.escalation {
    background: rgba(var(--warning-rgb, 255, 193, 7), 0.1);
    border-radius: 4px;
    padding: 0.5rem;
    margin: 0.25rem 0;
}

.breakdown-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.breakdown-value {
    font-weight: 600;
}

.breakdown-toggle {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.breakdown-toggle:hover {
    background: var(--bg-inset);
    border-radius: 4px;
    padding: 0.25rem;
    margin: 0.25rem -0.25rem 0 -0.25rem;
}

.breakdown-details {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-inset);
    border-radius: 6px;
    border: 1px solid var(--border);
    animation: slideDown 0.3s ease-out;
}

.breakdown-subitem {
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.component-breakdown {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
}

.component-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.25rem 0;
    border-bottom: 1px dotted var(--border);
}

.component-item:last-child {
    border-bottom: none;
}

.component-name {
    font-weight: 500;
    font-size: 0.8rem;
    flex: 1;
    margin-right: 0.5rem;
}

.component-amounts {
    text-align: right;
    flex-shrink: 0;
}

.base-amount {
    font-weight: 600;
    font-size: 0.85rem;
}

.escalation-note {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    line-height: 1.2;
}

.revenue-section .breakdown-value.text-success {
    color: var(--success) !important;
}

.revenue-section .component-amounts .base-amount {
    color: var(--success);
}

.cost-section .breakdown-value.text-danger {
    color: var(--danger) !important;
}

.cost-section .component-amounts .base-amount {
    color: var(--danger);
}

/* ========== ESCALATION FIELDS ========== */

.escalation-fields {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-inset);
    border-radius: 8px;
    border-left: none;
    transition: var(--transition-smooth);
}

.escalation-fields.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

/* ========== EXHIBITS ========== */

.exhibit-item {
    transition: var(--transition-smooth);
    border-radius: 8px;
}

.exhibit-item:hover {
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
}

.exhibit-letter-badge {
    flex-shrink: 0;
}

.exhibit-content-preview {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.exhibit-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.exhibit-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--bg-inset);
    border-radius: 8px;
    border: 2px dashed var(--border);
}

.exhibit-empty-state i {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.exhibit-card {
    transition: all 0.3s ease;
    border-left: 4px solid var(--border);
    position: relative;
}

.exhibit-card.active {
    border-left-color: var(--exhibit-primary);
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.15);
}

.exhibit-card.disabled {
    opacity: 0.6;
    background-color: var(--bg-inset);
}

.exhibit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.exhibit-nav {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.exhibit-nav .nav-link {
    border-radius: 8px;
    margin-bottom: 4px;
    padding: 12px 16px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    text-decoration: none;
}

.exhibit-nav .nav-link:hover {
    background-color: var(--bg-inset);
    color: var(--text);
}

.exhibit-nav .nav-link.active {
    background: var(--bg-inset);
    color: var(--primary);
    box-shadow: inset 4px 0 0 var(--primary);
    border-left: 4px solid var(--primary);
}

.exhibit-content {
    min-height: 400px;
}

.exhibit-header {
    background: transparent;
    color: var(--text);
    border-radius: 0;
    border-bottom: 1px solid var(--border);
}

.exhibit-toggle {
    position: static;
    background: var(--bg-inset);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.exhibit-toggle .form-check {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.exhibit-toggle .form-check-label {
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0;
}

.exhibit-toggle .form-check-input {
    width: 2.5rem;
    height: 1.25rem;
    border: 2px solid var(--text-secondary);
    cursor: pointer;
    margin: 0;
}

.exhibit-toggle .form-check-input:checked {
    background-color: var(--success);
    border-color: var(--success);
}

.exhibit-status {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 12px;
    position: absolute;
    top: 4px;
    right: 40px;
    z-index: 10;
}

.exhibit-status.enabled {
    background-color: rgba(var(--success-rgb, 22, 163, 74), 0.12);
    color: var(--success);
}

.exhibit-status.disabled {
    background-color: var(--bg-inset);
    color: var(--text-secondary);
}

.exhibit-nav-item {
    border-radius: 8px;
    transition: all 0.2s ease;
}

.exhibit-nav-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.nav-link.exhibit-tab {
    border-radius: 8px;
    padding: 12px;
    border: none;
    text-decoration: none;
    color: inherit;
    display: block;
}

.nav-link.exhibit-tab:hover {
    background-color: var(--bg-inset);
    text-decoration: none;
    color: inherit;
}

.nav-link.exhibit-tab.active {
    background: var(--bg-inset);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.nav-link.exhibit-tab.active .text-muted {
    color: var(--primary) !important;
}

.nav-toggle-container {
    z-index: 20;
    position: relative;
}

.nav-exhibit-toggle {
    transform: scale(0.8);
    margin: 0;
}

.card-header {
    position: relative;
    padding-right: 1rem;
}

#bulkActionsDropdown {
    border: none;
    padding: 4px 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
}

.dropdown-item:hover {
    background-color: var(--bg-inset);
}

/* ========== TEMPLATES ========== */

.template-browser {
    max-height: 300px;
    overflow-y: auto;
}

.template-item {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 12px;
    border: 1px solid var(--border);
}

.template-item:hover {
    background-color: var(--bg-inset);
    border-color: var(--exhibit-primary);
    transform: translateX(4px);
}

.template-item.selected {
    background-color: var(--primary-light);
    border-color: var(--exhibit-primary);
    color: var(--exhibit-primary);
}

.template-preview {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.875rem;
    background-color: var(--bg-inset);
    border-radius: 6px;
    padding: 12px;
}

.template-header {
    background: transparent;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.template-grid {
    display: grid;
    gap: 20px;
}

/* ========== EXHIBIT TYPE CARDS ========== */

.exhibit-type-card {
    transition: all 0.3s ease;
    border-left: 4px solid var(--border);
}

.exhibit-type-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stats-card {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.category-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 12px;
    background: var(--bg-inset);
    color: var(--text-secondary);
}

.usage-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-filters {
    background: var(--bg-card-alt);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.quick-stats {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
}

/* ========== VARIABLE HELPERS & TAGS ========== */

.form-section.active {
    border-left-color: var(--primary);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.1);
}

.variable-helper {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 16px;
}

.variable-tag {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.variable-tag:hover {
    background: var(--primary);
    color: var(--text-on-primary);
}

/* ========== EDITORS & PREVIEWS ========== */

.quill-editor {
    min-height: 300px;
}

.preview-panel {
    max-height: 500px;
    overflow-y: auto;
    background: var(--bg-inset);
    border-radius: 6px;
    padding: 20px;
}

.char-counter {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.cost-analysis-chart {
    height: 300px;
    margin: 1rem 0;
}

.email-compose-form .form-label {
    font-weight: 600;
    color: var(--text-secondary);
}

/* ========== MODALS ========== */

.modal-header {
    background: var(--bg-inset);
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.modal-header .btn-close {
    filter: none;
}

.modal-header.bg-primary {
    background: var(--primary) !important;
}

/* ========== EXPORT OPTIONS ========== */

.export-type-option {
    background: var(--bg-inset);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    height: 100%;
    position: relative;
    margin-bottom: 1rem;
}

.export-type-option:hover:not(:has(input:disabled)) {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.export-type-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.15);
}

.export-type-option:has(input:disabled) {
    background: var(--bg-inset);
    border-color: var(--border);
    opacity: 0.6;
}

.export-type-option .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    padding-left: 0.5rem;
    line-height: 1.6;
}

.form-check-label strong {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text);
    font-size: 1.1rem;
}

.form-check-label small {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: block;
}

#export_preview {
    background: var(--bg-inset);
    border: none;
    border-left: 4px solid var(--primary);
}

#preview_details .badge {
    font-size: 0.7rem;
}

/* ========== STATUS & BADGES ========== */

.status-badge {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    display: inline-block;
}

.status-badge.draft {
    background: var(--secondary, #6b7280);
    color: white;
}

.status-badge.pre_approved {
    background: var(--warning);
    color: var(--text);
}

.status-badge.sent_to_client {
    background: var(--info);
    color: white;
}

.status-badge.client_signed {
    background: var(--primary);
    color: white;
}

.status-badge.finalized {
    background: var(--success);
    color: white;
}

.status-badge.workflow-client-signed {
    background-color: var(--purple, #8b5cf6);
    color: white;
}

.priority-badge {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
}

.status-badge[class*="workflow-"] {
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== INFO TABLES ========== */

.info-table td {
    border: none;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-table td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    width: 40%;
}

/* ========== HISTORY & TIMELINE ========== */

.history-timeline {
    max-height: 400px;
    overflow-y: auto;
}

.timeline-item {
    padding: 1rem;
    border-left: 3px solid var(--border);
    margin-bottom: 1rem;
    background: var(--bg-inset);
    border-radius: 0 8px 8px 0;
}

.timeline-item.recent {
    border-left-color: var(--primary);
    background: var(--bg-inset);
}

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-marker {
    position: absolute;
    left: -22px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--border);
}

.timeline-content h6 {
    font-size: 14px;
    margin-bottom: 4px;
}

.timeline-content p {
    font-size: 12px;
    margin-bottom: 0;
}

/* ========== ACTION BUTTONS ========== */

.action-btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border: none;
    transition: var(--transition-smooth);
}

.action-btn:hover {
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
}

/* ========== CONTRACT VIEW: FINANCIAL SECTIONS ========== */

.fin-section {
    background: var(--bg-inset);
    padding: 1rem;
    border-radius: var(--radius-md, 0.5rem);
}

.fin-section-revenue {
    border-left: 4px solid var(--success);
}

.fin-section-cost {
    border-left: 4px solid var(--danger);
}

.fin-section-profit {
    border-left: 4px solid var(--success);
}

.fin-section-profit-loss {
    border-left: 4px solid var(--danger);
}

.bg-inset {
    background: var(--bg-inset);
}

.fin-stat-box {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    text-align: center;
    padding: 0.5rem;
    border-radius: var(--radius-md, 0.5rem);
}

.fin-toggle {
    cursor: pointer;
}

.fin-details-hidden {
    display: none;
}

.exhibit-item {
    border-left-width: 4px !important;
    border-left-style: solid !important;
}

.progress-slim {
    height: 6px;
    background: var(--border);
}

.progress-slim .progress-bar {
    background: var(--primary);
}

.profit-margin-badge {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
}

.exhibit-letter-circle {
    width: 40px;
    height: 40px;
    font-weight: bold;
}

/* ========== UTILITY CLASSES ========== */

.section-label {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
}

.modal-header-inset {
    background: var(--bg-inset);
    border-bottom: 1px solid var(--border);
}

.stat-number-lg {
    font-size: 2rem;
}

.cursor-pointer {
    cursor: pointer;
}

.accent-left-primary {
    border: none;
    border-left: 4px solid var(--primary);
}

/* ========== FLOATING ACTIONS & INDICATORS ========== */

.floating-save {
    position: sticky;
    bottom: 20px;
    z-index: 1040;
}

.save-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    min-width: 250px;
}

.save-status {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    min-width: 200px;
}

.floating-actions {
    position: sticky;
    bottom: 20px;
    z-index: 1040;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow-md, 0 4px 20px rgba(0, 0, 0, 0.1));
    padding: 16px;
}

/* ========== TOASTS & NOTIFICATIONS ========== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    min-width: 300px;
    margin-bottom: 0.5rem;
    box-shadow: var(--card-shadow);
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
}

/* ========== LOADING & PROGRESS ========== */

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-indicator {
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    height: 8px;
}

.progress-bar {
    background: var(--primary);
    transition: width 0.3s ease;
}

/* ========== VERSION INFO ========== */

.version-info-display {
    background-color: var(--bg-inset) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    margin-bottom: 0 !important;
}

.version-info-display .badge {
    background-color: var(--primary) !important;
}

/* ========== AVATARS ========== */

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.avatar-circle-sm {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 10px;
}

.avatar-circle-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

/* ========== TABLES ========== */

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--text);
    background-color: var(--bg-inset);
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--primary-rgb), 0.04);
}

.list-group-item-action:focus,
.list-group-item-action:hover {
    background-color: rgba(var(--primary-rgb), 0.06);
}

.contract-checkbox,
#selectAll {
    cursor: pointer;
}

.table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.card[style*="border: none"] {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.font-monospace {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.table-success {
    --bs-table-accent-bg: var(--bs-success-bg-subtle);
}

.badge {
    font-size: 0.75em;
}

.btn-group-sm > .btn,
.btn-sm {
    --bs-btn-padding-y: 0.25rem;
    --bs-btn-padding-x: 0.5rem;
    --bs-btn-font-size: 0.875rem;
}

/* ========== LOGIN PAGE ========== */

body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease-out;
}

.login-header {
    background: transparent;
    color: var(--text);
    padding: 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.login-header h1 {
    font-size: 1.5rem;
    margin: 0.5rem 0 0.25rem;
    font-weight: 700;
}

.login-header p {
    opacity: 0.8;
    font-size: 0.85rem;
    margin: 0;
}

.login-body {
    padding: 2rem 1.5rem;
}

.welcome-text {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form .form-floating {
    margin-bottom: 1rem;
}

.login-form .form-floating .form-control {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
}

.login-form .form-floating .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.login-form .form-floating label {
    color: var(--text-muted);
}

/* ========== PRICING COMPONENTS ========== */

.pricing-component {
    background: var(--bg-card-alt);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.internal-costs-section {
    background: var(--bg-card-alt);
    border-left: 4px solid var(--accent-cost);
}

/* ========== QUILL EDITOR ========== */

.ql-toolbar {
    background: var(--bg-card);
    border-color: var(--border) !important;
}

.ql-container {
    background: var(--bg-card);
    border-color: var(--border) !important;
    color: var(--text);
}

.ql-editor.ql-blank::before {
    color: var(--text-muted);
}

.ql-snow .ql-stroke {
    stroke: var(--text-secondary);
}

.ql-snow .ql-fill {
    fill: var(--text-secondary);
}

.ql-snow .ql-picker-label {
    color: var(--text-secondary);
}

/* ========== ANIMATIONS ========== */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

.fa-bolt {
    animation: pulse 2s infinite;
}

/* ========== RESPONSIVE DESIGN ========== */

@media (max-width: 768px) {
    .modern-card-body {
        padding: 1.5rem 1rem;
    }

    .value-display-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .value-display {
        font-size: 1.75rem;
    }

    .quick-stats-grid {
        grid-template-columns: 1fr;
    }

    .exhibit-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .floating-actions {
        position: static;
        margin-top: 20px;
        box-shadow: none;
        border: 1px solid var(--border);
    }
}

@media (max-width: 992px) {
    .financial-breakdown {
        font-size: 0.85rem;
    }

    .component-name {
        font-size: 0.75rem;
    }

    .base-amount {
        font-size: 0.8rem;
    }

    .exhibit-nav {
        position: static;
        max-height: none;
        margin-bottom: 20px;
    }

    .exhibit-nav .nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .exhibit-nav .nav-link {
        white-space: nowrap;
        min-width: 120px;
        text-align: center;
    }

    .exhibit-toggle {
        position: static;
        background: var(--bg-inset);
        margin: 15px 0;
        padding: 12px 15px;
        border: 1px solid var(--border);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
    }

    .exhibit-toggle .form-check-label {
        color: var(--text);
    }
}

@media (min-width: 768px) {
    .template-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}


/* ============================================================
   SETTINGS PAGE
   Layout picker, color swatches, logo upload, live preview
   ============================================================ */

/* ---- Layout Option Cards ---- */
.layout-option-card {
    display: block;
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: var(--radius, 8px);
    padding: 0.75rem;
    transition: all 0.2s ease;
    background: var(--bg-card);
}
.layout-option-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
}
.layout-option-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}
.layout-label {
    margin-top: 0.5rem;
    text-align: center;
}
.layout-label strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text);
}
.layout-label small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---- Mini Preview Boxes ---- */
.mini-preview-box {
    background: var(--bg-inset);
    border-radius: var(--radius-sm, 6px);
    padding: 8px;
    min-height: 90px;
}
.mp-nav {
    height: 10px;
    background: var(--bg-navbar, #2d2d44);
    border-radius: 2px;
    margin-bottom: 6px;
}
.mp-title {
    height: 6px;
    width: 40%;
    background: var(--text-muted);
    border-radius: 2px;
    margin-bottom: 6px;
    opacity: 0.5;
}
.mp-title-accent {
    height: 10px;
    width: 50%;
    border-left: 3px solid var(--primary);
    background: var(--bg-card);
    border-radius: 0 2px 2px 0;
    margin-bottom: 6px;
}
.mp-header-gradient {
    height: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    margin-bottom: 6px;
}
.mp-row {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}
.mp-stat {
    flex: 1;
    height: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
}
.mp-card {
    height: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
}
.mp-card-accent {
    height: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 2px;
}
.mp-card-soft {
    height: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ---- Color Swatches ---- */
.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    margin: 0 auto;
}
.color-swatch:hover {
    transform: scale(1.1);
}
.color-swatch.active {
    border-color: var(--text);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.3);
}
.color-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.color-label.active {
    color: var(--text);
    font-weight: 600;
}

/* ---- Logo Upload Zones ---- */
.logo-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius, 8px);
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-upload-zone:hover {
    border-color: var(--primary);
    background: var(--bg-hover, var(--bg-inset));
}
.logo-upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.logo-upload-placeholder i {
    font-size: 1.5rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.5rem;
}
.upload-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.logo-preview {
    position: relative;
    display: inline-block;
}
.logo-preview img {
    max-width: 200px;
    max-height: 60px;
    object-fit: contain;
}
.logo-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 50%;
}

/* ---- Favicon Tab Preview ---- */
.favicon-tab-preview {
    display: inline-block;
}
.tab-mockup {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card-alt, var(--bg-inset));
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.fav-icon-box {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fav-icon-box img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}
.tab-close {
    color: var(--text-muted);
    cursor: default;
    font-size: 1rem;
    line-height: 1;
}

/* ---- Live Preview Frame ---- */
.live-preview-frame {
    background: var(--bg-body);
    border-radius: 0 0 var(--radius, 8px) var(--radius, 8px);
    overflow: hidden;
    min-height: 250px;
}
.lp-navbar {
    background: var(--bg-navbar, #2d2d44);
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.lp-brand {
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.lp-logo-icon {
    font-size: 0.6rem;
    opacity: 0.8;
}
.lp-nav-links {
    display: flex;
    gap: 6px;
}
.lp-link {
    color: rgba(255,255,255,0.5);
    font-size: 0.55rem;
    padding: 2px 4px;
    border-radius: 3px;
}
.lp-link.active {
    color: white;
    background: rgba(255,255,255,0.15);
}
.lp-content {
    padding: 10px;
}
.lp-page-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.lp-stats {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.lp-stat-card {
    flex: 1;
    height: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
}
.lp-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.lp-card-body {
    padding: 8px;
}
.lp-line {
    height: 4px;
    background: var(--bg-inset);
    border-radius: 2px;
    margin-bottom: 4px;
}
/* Layout B preview */
.lp-card.layout-b {
    border-top: 3px solid var(--primary);
}
.lp-stat-card.layout-b {
    border-top: 2px solid var(--primary);
}
/* Layout C preview */
.lp-card.layout-c {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.lp-page-title.layout-c {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
}

/* ---- Settings Page: Cosmetic Styles ---- */
.mp-nav-accent {
    border-bottom: 2px solid var(--primary);
}
.theme-label-heading {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.form-label-small {
    font-size: 0.85rem;
    font-weight: 500;
}
.favicon-preview-img {
    max-width: 48px;
    max-height: 48px;
}
.favicon-default-icon {
    font-size: 10px;
    color: var(--primary);
}
.preview-hint-text {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}
.sticky-preview-card {
    top: 1rem;
}
