:root {
    --primary: #2ecc71;
    --primary-dark: #27ae60;
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding: 2rem;
}

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

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

h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(to right, #2ecc71, #3498db);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#main-content {
    margin-top: 1rem;
}

.unassigned-full-width {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
}

.tab-content {
    display: none;
}

.column-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

/* Card Styling */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.budget-ref {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary);
}

.thirdparty {
    font-size: 1rem;
    font-weight: 600;
}

.line-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    cursor: grab;
    border: 1px solid transparent;
}

.line-item.has-accordion {
    padding: 0;
}

.line-accordion {
    padding: 0;
}

.line-accordion summary {
    list-style: none;
    cursor: pointer;
    padding: 0.75rem;
}

.line-accordion summary::-webkit-details-marker {
    display: none;
}

.line-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.line-summary .line-title {
    font-size: 0.9rem;
    font-weight: 700;
}

.line-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.line-accordion[open] .line-toggle {
    transform: rotate(45deg);
}

.line-body {
    padding: 0 0.75rem 0.75rem;
}

.line-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border);
}

.line-item.type-producto {
    border-left: 4px solid #f1c40f;
    background: rgba(241, 196, 15, 0.05);
}

.line-item.type-servicio {
    border-left: 4px solid #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.type-tag {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}

.type-tag.producto {
    background: #f1c40f;
    color: #000;
}

.type-tag.servicio {
    background: #3498db;
    color: #fff;
}

.line-title {
    font-weight: 600;
}

.line-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0.25rem 0;
}

.line-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.planning-line-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.reassign-select {
    width: auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.4rem;
}

.amount {
    font-weight: 700;
    color: #fff;
}

/* Assignment Controls */
.assign-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: none;
    background: var(--glass);
    color: var(--text);
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.2s;
}

.assign-btn:hover {
    background: var(--primary);
}

/* Planning Area */
.planning-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.personal-planning-full {
    background: rgba(46, 204, 113, 0.05);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 1.25rem;
    padding: 1.5rem;
    width: 100%;
}

.personal-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.person-column {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 1.25rem;
    padding: 1.25rem;
    min-height: 500px;
    border: 1px dashed var(--border);
}

.person-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active {
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1.1rem;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* Toast */
.toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 3000;
    max-width: 360px;
    padding: 0.8rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    background: rgba(239, 68, 68, 0.95);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-warning {
    background: rgba(245, 158, 11, 0.95);
    color: #1f2937;
    border-color: rgba(245, 158, 11, 0.6);
}

.toast-error {
    background: rgba(239, 68, 68, 0.95);
    border-color: rgba(239, 68, 68, 0.6);
}

/* Data Table (for Registros) */
.table-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

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

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

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.search-bar {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}

.search-input {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: #fff;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
}

.type-select {
    margin-bottom: 0.5rem;
    width: 100%;
}

.budget-ref a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.budget-ref a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Loader */
.loader {
    border: 3px solid var(--glass);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.syncing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.user-badge {
    background: var(--glass);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border);
    font-size: 0.85rem;
}

.user-badge strong {
    color: #fff;
}

.logout-btn {
    padding: 0.3rem 0.7rem;
    border-radius: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(239, 68, 68, 0.2);
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #ef4444;
    color: #fff;
}

.logs-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    font-size: 0.8rem;
    height: calc(100vh - 200px);
    overflow-y: auto;
}

.log-entry {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    display: block;
    margin-bottom: 0.2rem;
}

.log-user {
    font-weight: 700;
    color: var(--primary);
}

.log-action {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    background: var(--glass);
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    margin-right: 0.3rem;
}

@media (max-width: 1600px) {
    .unassigned-full-width {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {

    .unassigned-full-width,
    .planning-grid {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .header-right {
        align-items: flex-start;
    }

    .nav-menu {
        flex-wrap: wrap;
        gap: 1rem;
    }
}

/* Priority Colors */
.status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    width: fit-content;
    border: 1px solid var(--border);
}

.priority-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s;
    flex-shrink: 0;
}

.priority-circle:hover {
    transform: scale(1.2);
    border-color: #fff;
}

.bg-red {
    background-color: #ff4757;
    box-shadow: 0 0 5px #ff4757;
}

.bg-black {
    background-color: #000;
    box-shadow: 0 0 5px #000;
}

.bg-blue {
    background-color: #1e90ff;
    box-shadow: 0 0 5px #1e90ff;
}

/* Status Context Colors (Card Backgrounds) */
.card-status-red {
    border-left: 5px solid #ff4757 !important;
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.1), rgba(30, 41, 59, 0.7)) !important;
}

.card-status-black {
    border-left: 5px solid #000 !important;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(30, 41, 59, 0.7)) !important;
}

.card-status-blue {
    border-left: 5px solid #1e90ff !important;
    background: linear-gradient(135deg, rgba(30, 144, 255, 0.1), rgba(30, 41, 59, 0.7)) !important;
}

.planning-notes-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 0.4rem;
    margin: 0.5rem 0;
    max-height: 100px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.action-icon-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2rem;
    color: #fff;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.action-icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.action-icon-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #0b1220;
    color: #fff;
    padding: 0.2rem 0.45rem;
    border-radius: 0.4rem;
    border: 1px solid var(--border);
    font-size: 0.65rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 5;
}

.action-icon-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.action-icon-edit {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.45);
}

.action-icon-baja {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.action-icon-zombie {
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.5);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    /* Increased to stay above everything */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: #1e293b;
    padding: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
}

.modal-close {
    color: var(--text-muted);
    font-size: 2.5rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: #ef4444;
}

/* Quill Customization */
#editor-container {
    height: 400px;
    background: #fff;
    color: #333;
    border-radius: 0.75rem;
    overflow: hidden;
    font-size: 1.1rem;
}

.ql-toolbar.ql-snow {
    border: none !important;
    background: #f1f5f9;
    padding: 0.75rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.ql-container.ql-snow {
    border: none !important;
}

.modal-footer {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1.25rem;
}

.btn-save {
    background: linear-gradient(to right, #2ecc71, #27ae60);
    color: #fff;
    border: none;
    padding: 0.8rem 2.5rem;
    border-radius: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

.btn-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.8rem 2.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(to right, #ef4444, #dc2626);
    color: #fff;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 0.6rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}
