:root {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.7);
    --surface-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    overflow: hidden;
    position: relative;
}

/* Scrollbars personalizadas */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Ambient Lights */
.ambient-light {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}
.light-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: rgba(59, 130, 246, 0.25); /* Blue */
}
.light-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: rgba(139, 92, 246, 0.25); /* Purple */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glassmorphism Card */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    width: 300px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.view-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
}

.btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-success {
    background: #10b981;
}
.btn-success:hover {
    background: #059669;
}

/* Button Group */
.action-group {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
.btn-icon {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid transparent;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover {
    background: var(--surface-bg);
    border-color: var(--surface-border);
}
.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-danger {
    color: #ef4444;
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Table */
.table-container {
    overflow-x: auto;
    max-width: 100%;
}

table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th, td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--surface-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
}

th {
    position: relative;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
}

.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 1;
    transition: background-color 0.2s;
}
.col-resizer:hover, .col-resizer.resizing {
    background-color: var(--accent-color);
}

tbody tr {
    transition: background-color 0.2s;
    cursor: pointer;
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

tbody tr.row-selected {
    background-color: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--accent-color);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-pending { background-color: rgba(234, 179, 8, 0.2); color: #eab308; }
.status-processed { background-color: rgba(34, 197, 94, 0.2); color: #22c55e; }

/* Inline Contract Input */
.inline-contract-input {
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    color: var(--text-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    width: 100%;
    min-width: 100px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.inline-contract-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.2);
}

.inline-contract-input.save-success {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.1) !important;
}

/* Action buttons */
/* Settings Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: #1e293b;
    border: 1px solid var(--surface-border);
    border-radius: 1rem;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-btn:hover {
    color: white;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-color);
}

.columns-list {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 0.5rem;
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--surface-border);
}

.column-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: grab;
}

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

.column-item input[type="checkbox"] {
    margin-right: 1rem;
    width: 1.2rem;
    height: 1.2rem;
}

.drag-handle {
    margin-left: auto;
    color: var(--text-secondary);
    cursor: grab;
}

/* Toast Notification */
#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--success-color);
    color: #fff;
    text-align: center;
    border-radius: 0.5rem;
    padding: 1rem;
    position: fixed;
    z-index: 1001;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    font-weight: 500;
}

#toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

/* Loader */
.loader {
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top: 3px solid var(--accent-color);
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    flex-direction: column;
    gap: 1rem;
    color: var(--text-secondary);
}

/* Details Panel */
.resizer {
    height: 8px;
    background: transparent;
    cursor: row-resize;
    margin: 0.5rem 0;
    border-radius: 4px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}
.resizer:hover, .resizer.resizing {
    background: var(--accent-color);
}

.details-panel {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--surface-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    overflow-y: auto;
    height: 250px;
    flex-shrink: 0;
    animation: fadein 0.3s;
}

.details-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--surface-border);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.detail-card-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-card-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

