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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: #f1f5f9;
}

.container {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.05);
}

/* ==========================================
   TOOLBAR
   ========================================== */

.toolbar {
    background: #1e293b;
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.toolbar h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

.toolbar-separator {
    color: #475569;
    font-size: 18px;
    font-weight: 300;
    flex-shrink: 0;
}

.project-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-dropdown {
    padding: 7px 32px 7px 14px;
    border: 1px solid #475569;
    border-radius: 8px;
    font-size: 13px;
    background: #334155;
    color: white;
    cursor: pointer;
    min-width: 160px;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.project-dropdown:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(129,140,248,0.25);
}

.btn-project {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #475569;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-project:hover, .btn-project-delete:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.view-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.view-actions .btn {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 6px;
}

.view-actions .btn-icon-only {
    width: 34px;
    height: 34px;
    padding: 0;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.view-actions .btn-icon-only:hover {
    background: #e2e8f0;
    color: #1e293b;
    box-shadow: none;
}

.view-actions .btn-icon-only:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.view-actions .btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.view-actions .btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
    box-shadow: none;
}

.view-select {
    height: 34px;
    padding: 0 32px 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    color: #1e293b;
    background: #f1f5f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    box-sizing: border-box;
    line-height: 32px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.view-select:hover {
    border-color: #94a3b8;
}

.view-select:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(129,140,248,0.2);
}

.view-actions-separator {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
    margin: 0 4px;
}

.btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    background: #4f46e5;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.btn-icon-only {
    padding: 0;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* ==========================================
   SIDEBAR NAVIGATION
   ========================================== */

.app-body {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 52px;
    min-width: 52px;
    background: #1e293b;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    gap: 2px;
    transition: width 0.2s ease;
    overflow: hidden;
    z-index: 20;
}

.sidebar:hover {
    width: 180px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.06);
}

.sidebar-item.active {
    color: white;
    background: rgba(255,255,255,0.08);
    border-left-color: #818cf8;
}

.sidebar-item.sidebar-item-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.sidebar-label {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.sidebar:hover .sidebar-label {
    opacity: 1;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding-left: 12px;
}

/* ==========================================
   ROADMAP VIEW
   ========================================== */

#roadmapView {
    padding: 24px 0 0 0;
}

#roadmapView > .financial-header {
    padding: 0 24px 16px;
}

.roadmap-frame {
    margin: 0 24px;
    padding: 0 !important;
    overflow: visible;
}

/* ==========================================
   TOP CONTROLS (Milestones, Task bars, Trash)
   ========================================== */

.top-controls {
    display: flex;
    gap: 16px;
    padding: 0 24px 16px;
    align-items: stretch;
}

.top-controls-section {
    flex: 1;
    min-width: 0;
}

.top-controls-section:last-child {
    flex: 0 0 auto;
}

.task-bar-steps {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-bar-step {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #6366f1;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-text {
    font-size: 11px;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
}

.step-arrow {
    color: #cbd5e1;
    font-size: 14px;
    flex-shrink: 0;
}

.milestone-items {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.milestone-template {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: grab;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.milestone-template:active {
    cursor: grabbing;
    transform: scale(0.97);
}

.milestone-template:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #818cf8;
    background: #fff;
}

.milestone-template-diamond {
    font-size: 16px;
    line-height: 1;
    font-weight: bold;
    flex-shrink: 0;
}

.milestone-template-label {
    font-size: 11px;
    color: #475569;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.milestone-template[data-type="sponsors"] .milestone-template-diamond {
    color: #10b981;
}

.milestone-template[data-type="implementation"] .milestone-template-diamond {
    color: #ef4444;
}

.milestone-template[data-type="custom"] .milestone-template-diamond {
    color: #8b5cf6;
}

.trash-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    min-width: 140px;
    background: linear-gradient(135deg, #fef2f2 0%, #fce8e8 100%);
    border: 2px dashed #fca5a5;
    border-radius: 12px;
    transition: all 0.25s ease;
    cursor: default;
}

.trash-zone.drag-over {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #ef4444;
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12), 0 4px 12px rgba(239, 68, 68, 0.15);
    transform: scale(1.04);
}

.trash-zone svg {
    color: #ef4444;
    opacity: 0.4;
    transition: all 0.25s ease;
}

.trash-zone.drag-over svg {
    opacity: 1;
    transform: scale(1.2);
    filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.3));
}

.trash-text {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    transition: all 0.25s ease;
}

.trash-zone.drag-over .trash-text {
    color: #dc2626;
}

/* ==========================================
   ROADMAP TABLE
   ========================================== */

.roadmap-with-overview {
    display: flex;
    gap: 0;
}

.roadmap-container {
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-width: 0;
    position: relative;
}

.roadmap-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
    width: max-content;
    table-layout: auto;
}

.roadmap-table td.group-cell {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
}

.month-header {
    background: #1e293b;
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid #334155;
    font-size: 13px;
    letter-spacing: 0.3px;
    height: 17px;
}

.week-row th {
    background: #475569;
    color: #e2e8f0;
    padding: 6px 3px;
    text-align: center;
    font-size: 10px;
    border-right: 1px solid #526577;
    font-weight: 500;
    min-width: 35px;
    max-width: 35px;
}

.week-cell div {
    line-height: 1.2;
}

.group-header, .group-header-sub {
    background: #475569;
    color: white;
    min-width: 24px;
    max-width: 24px;
    width: 24px;
    position: sticky;
    left: 0;
    z-index: 10;
    border-right: 1px solid #334155;
}

.header-row .group-header {
    background: #1e293b;
}

.task-header, .task-header-sub {
    background: #1e293b;
    color: white;
    min-width: 250px;
    max-width: 250px;
    width: 250px;
    position: sticky;
    left: 24px;
    z-index: 10;
}

.group-cell {
    background: linear-gradient(180deg, #475569 0%, #3d4f63 100%);
    color: white;
    padding: 8px 0;
    font-weight: 500;
    border-right: 1px solid #334155;
    border-bottom: 1px solid #334155;
    position: sticky;
    left: 0;
    z-index: 7;
    min-width: 24px !important;
    max-width: 24px !important;
    width: 24px !important;
    text-align: center;
    vertical-align: top;
    font-size: 10px;
    letter-spacing: 0px;
    overflow: hidden;
    box-sizing: border-box;
    transition: all 0.15s;
}

.group-cell.drop-over {
    background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: inset 0 0 0 2px rgba(99,102,241,0.6);
}

.group-cell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    padding-top: 8px;
}

.group-name {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin-bottom: 12px;
    font-weight: 600;
    max-width: 20px;
    overflow: visible;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.group-name-export {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    transform-origin: center center;
    font-weight: 600;
    font-size: 8px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    max-width: 90vh;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 18px;
    text-transform: uppercase;
}

body.exporting .group-name {
    display: none !important;
}

body.exporting .group-name-export {
    display: block !important;
}

body.exporting .group-cell {
    overflow: visible !important;
}

body.exporting .group-cell-content {
    overflow: visible !important;
}

body.exporting .roadmap-with-overview {
    align-items: stretch;
}

body.exporting .trimestre-overview {
    height: auto;
}

body.exporting .connection-handle {
    opacity: 0 !important;
}

.group-cell button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px auto;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0;
    font-size: 8px;
    border-radius: 3px;
    width: 16px !important;
    max-width: 16px !important;
    min-width: 16px !important;
    height: 16px;
    transition: all 0.15s;
    box-sizing: border-box;
}

.group-cell button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.group-cell .delete-group-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fecaca;
}

.task-cell {
    background: #1e293b;
    color: white;
    padding: 5px 12px 5px 12px;
    font-weight: 500;
    border-bottom: 1px solid #334155;
    position: sticky;
    left: 24px;
    z-index: 6;
    font-size: 13px;
    min-height: 90px;
    height: 90px;
    overflow: visible;
    cursor: move;
    transition: opacity 0.15s;
}

.task-cell:active {
    cursor: grabbing;
}

.task-cell input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    line-height: 1.5;
    padding: 0 0 0 10px;
}

.task-name-input {
    height: 22px;
}

.task-cell input::placeholder {
    color: #64748b;
}

.task-cell .task-info {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.timeline-cell {
    background: #eef2f7;
    padding: 30px 5px;
    border-right: 1px solid #dde3eb;
    border-bottom: 1px solid #dde3eb;
    position: relative;
    min-height: 90px;
    min-width: 35px;
    max-width: 35px;
    vertical-align: middle;
}

.timeline-cell.current-week {
    background: #fefce8;
    border-left: 2px solid #eab308;
    border-right: 2px solid #eab308;
}

.timeline-cell.drop-over {
    background: #dbeafe;
    outline: 2px dashed #6366f1;
    outline-offset: -4px;
}

.task-bar-preview {
    opacity: 0.4;
    background: #3498db;
    pointer-events: none;
    border: 2px dashed rgba(255, 255, 255, 0.6);
    animation: preview-pulse 1.2s ease-in-out infinite;
}

@keyframes preview-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.55; }
}

/* ==========================================
   TASK BARS
   ========================================== */

.task-bar {
    position: absolute;
    bottom: 5px;
    left: 0;
    height: 20px;
    background: #6366f1;
    border-radius: 4px;
    z-index: 2;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    color: white;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    overflow: visible;
    border: none;
    transition: opacity 0.15s;
    gap: 6px;
    min-height: 20px;
    max-height: 80px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.task-bar .task-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-bar .task-owner {
    font-size: 9px;
    background: rgba(0, 0, 0, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    flex-shrink: 0;
}

.task-bar:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.task-bar.dragging {
    opacity: 0.5;
    pointer-events: none;
}

.task-bar.dragging .resize-handle-vertical,
.task-bar.dragging .resize-handle-horizontal {
    pointer-events: none;
}

.task-bar.resizing {
    pointer-events: none;
}

.resize-handle-horizontal {
    position: absolute;
    top: 8px;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    z-index: 10;
}

.resize-handle-horizontal:hover {
    background: rgba(255, 255, 255, 0.25);
}

.resize-handle-left {
    left: 0;
    border-left: 2px solid transparent;
}

.resize-handle-left:hover {
    border-left-color: rgba(255, 255, 255, 0.8);
}

.resize-handle-right {
    right: 0;
    border-right: 2px solid transparent;
}

.resize-handle-right:hover {
    border-right-color: rgba(255, 255, 255, 0.8);
}

.resize-handle-vertical {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 8px;
    cursor: ns-resize;
    z-index: 11;
    border-top: 2px solid transparent;
    background: transparent;
    pointer-events: auto;
}

.resize-handle-vertical:hover {
    background: rgba(255, 255, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.8);
}

/* ==========================================
   MILESTONES
   ========================================== */

.milestone {
    position: absolute;
    left: 50%;
    top: 10%;
    transform: translate(-50%, -50%);
    cursor: grab;
    user-select: none;
    z-index: 3;
    transition: transform 0.15s;
    pointer-events: none;
}

.milestone.dragging {
    pointer-events: none;
    opacity: 0.3;
}

.milestone-content:hover {
    transform: scale(1.1);
}

.milestone:active {
    cursor: grabbing;
}

.milestone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    transition: transform 0.15s;
}

.milestone-diamond-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.milestone-diamond {
    font-size: 24px;
    line-height: 0.7;
    font-weight: bold;
}

.milestone[data-type="sponsors"] .milestone-diamond {
    color: #10b981;
}

.milestone[data-type="implementation"] .milestone-diamond {
    color: #ef4444;
}

.milestone[data-type="custom"] .milestone-diamond {
    color: #8b5cf6;
}

.milestone-label {
    font-size: 9px;
    text-align: center;
    white-space: nowrap;
    color: #334155;
    font-weight: 500;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ==========================================
   ROW CONTROLS & INPUTS
   ========================================== */

.delete-row-btn {
    background: transparent;
    color: #94a3b8;
    border: 1px solid transparent;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-left: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
}

.row-controls:hover .delete-row-btn,
.task-cell:hover .delete-row-btn {
    opacity: 1;
}

.delete-row-btn:hover {
    /*background: #fef2f2;
    color: #ef4444;
    border-color: #fecaca;*/
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
}

.row-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
    min-width: 400px;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content-wide {
    max-width: 700px;
    width: 700px;
}

/* Rich text editor */
.richtext-editor {
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.15s;
}
.richtext-editor:focus-within {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129,140,248,0.15);
}
.richtext-toolbar {
    display: flex;
    gap: 2px;
    padding: 4px 6px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.richtext-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.richtext-btn:hover { background: #e2e8f0; }
.richtext-btn.active { background: #818cf8; color: white; }
.richtext-separator {
    width: 1px;
    background: #e2e8f0;
    margin: 2px 4px;
}
.richtext-content {
    min-height: 60px;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    line-height: 1.5;
    outline: none;
    background: white;
}
.richtext-content:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
}
.richtext-content ul, .richtext-content ol { margin: 4px 0; padding-left: 20px; }
.richtext-content li { margin: 2px 0; }

/* Comments section */
.comments-section { border: 1.5px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.comments-list { max-height: 180px; overflow-y: auto; padding: 0; }
.comments-list:empty { display: none; }
.comment-item { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; }
.comment-item:last-child { border-bottom: none; }
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.comment-author { font-weight: 600; font-size: 12px; color: #334155; }
.comment-date { font-size: 11px; color: #94a3b8; }
.comment-text { font-size: 13px; color: #475569; line-height: 1.4; word-break: break-word; }
.comment-input-row { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #e2e8f0; background: #f8fafc; }
.comment-input { flex: 1; margin: 0 !important; font-size: 13px; height: 34px; }
.btn-sm { padding: 6px 12px; font-size: 12px; height: 34px; white-space: nowrap; }
.comment-delete-btn { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 14px; padding: 0 0 0 6px; line-height: 1; vertical-align: middle; }
.comment-delete-btn:hover { color: #ef4444; }
.comment-item-deleted { opacity: 0.6; }
.comment-deleted { color: #94a3b8; }
.comments-empty { padding: 12px; text-align: center; font-size: 12px; color: #94a3b8; font-style: italic; }

.modal-content h3 {
    margin: 0 0 24px 0;
    color: #0f172a;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 18px;
}

.form-group-inline {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.form-group-half {
    flex: 1;
}

.form-group-third {
    flex: 1;
}

.form-group-quarter > .form-group-half {
    flex: 1;
    min-width: 0;
}
.form-group-quarter > .form-group-half label {
    font-size: 12px;
}

.form-group label,
.form-group-half label,
.form-group-third label {
    display: block;
    color: #334155;
    font-weight: 600;
    font-size: 13px;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.15s;
    color: #0f172a;
}

.modal-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129,140,248,0.15);
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.15s;
}

.color-option:hover {
    transform: scale(1.08);
    border-color: #334155;
}

.color-option.selected {
    border-color: #334155;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.3);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.modal-actions .btn {
    flex: 1;
    padding: 10px 16px;
    font-weight: 600;
}

.btn-primary {
    background: #6366f1;
}

.btn-primary:hover {
    background: #4f46e5;
}

.btn-secondary {
    background: #94a3b8;
}

.btn-secondary:hover {
    background: #64748b;
}

/* ==========================================
   TRIMESTRE OVERVIEW PANEL
   ========================================== */

.trimestre-overview {
    width: 320px;
    min-width: 320px;
    background: white;
    border-left: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.trimestre-header {
    background: #1e293b;
    color: white;
    padding: 12px 20px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.trimestre-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.trimestre-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.trimestre-selector {
    display: flex;
    gap: 4px;
}

.trimestre-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 1px 2px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 9px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s;
}

.trimestre-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.trimestre-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 3px;
}

.year-nav-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 1px 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 9px;
    transition: all 0.15s;
}

.year-nav-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.selected-year {
    font-size: 13px;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

.trimestre-tasks {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.trimestre-months-row {
    display: flex;
    background: #475569;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.trimestre-month-cell {
    flex: 1;
    color: #e2e8f0;
    padding: 11.5px 3px;
    text-align: center;
    font-size: 10px;
    font-weight: 500;
    border-right: 1px solid #526577;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trimestre-month-cell:last-child {
    border-right: none;
}

.trimestre-tasks-structure {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.trimestre-row {
    display: flex;
    min-height: 90px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.trimestre-group-cell {
    background: linear-gradient(180deg, #475569 0%, #3d4f63 100%);
    color: white;
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    border-right: 1px solid #334155;
    display: none;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
}

.trimestre-group-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    white-space: nowrap;
    display: none;
}

.trimestre-task-cell {
    flex: 1;
    background: #eef2f7;
    padding: 5px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    align-content: start;
    grid-auto-flow: dense;
    overflow: hidden;
}

.trimestre-empty-row {
    height: 100%;
}

.trimestre-task-item {
    background: white;
    padding: 0 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.1s;
    border-left: 3px solid;
    min-height: 10px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    cursor: help;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.trimestre-task-item:hover {
    background: #f8fafc;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.trimestre-task-label {
    flex: 1;
    font-size: 10px;
    color: #334155;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.trimestre-milestone-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 2px;
}

.trimestre-milestone-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.trimestre-milestone-diamond {
    font-size: 14px;
    line-height: 1;
    font-weight: bold;
    flex-shrink: 0;
}

.trimestre-milestone-label {
    font-size: 9px;
    color: #334155;
    font-weight: 500;
    background: white;
    padding: 1px 4px;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trimestre-task-dates {
    font-size: 10px;
    color: #94a3b8;
    font-style: italic;
}

.trimestre-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    padding: 20px;
    font-style: italic;
}

@media print {
    .toolbar,
    .top-controls,
    .delete-row-btn,
    .trimestre-controls {
        display: none;
    }
}

/* ==========================================
   FINANCIAL VIEW
   ========================================== */

#financialView {
    padding: 24px;
}

.financial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.financial-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 22px;
    font-weight: 700;
}


.financial-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.financial-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}

.financial-section > h3 {
    margin: 0 0 18px 0;
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 2px solid #818cf8;
    padding-bottom: 10px;
}

/* Global Stats */
.global-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    opacity: 0.85;
    font-weight: 500;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
}

/* Budget by Group */
.budget-by-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group-budget-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px 18px;
    border: 1px solid #e2e8f0;
}

.group-budget-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.financial-group-name {
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    writing-mode: horizontal-tb;
}

.group-budget-amount {
    font-weight: 700;
    color: #0f172a;
    font-size: 16px;
}

.group-budget-bar-container {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.group-budget-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #818cf8 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.group-budget-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
}

.group-meta {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.group-meta strong {
    color: #0f172a;
    font-weight: 600;
}

/* Period Selector */
.period-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
}

.period-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s;
}

.period-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.period-btn.active {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

/* Budget by Period */
.budget-by-period {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.period-budget-card {
    background: #f8fafc;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.period-budget-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

.period-budget-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.period-budget-meta {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
}

.period-weeks {
    color: #64748b;
    font-weight: 500;
}

.period-adr {
    color: #334155;
    font-weight: 600;
}

/* Detailed Table */
.search-bar-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.search-input {
    flex: 1;
    padding: 5px 10px 5px 28px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    font-family: inherit;
    color: #374151;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 9px center;
    outline: none;
    transition: border-color 0.15s;
}

.search-input:focus {
    border-color: #6366f1;
}

.search-results-count {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    min-width: 100px;
    text-align: right;
}

.table-container {
    overflow-x: auto;
}

.detailed-budget-table tbody tr.hidden {
    display: none;
}

.detailed-budget-table {
    width: 100%;
    border-collapse: collapse;
}

.detailed-budget-table th {
    background: #1e293b;
    color: white;
    padding: 11px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.detailed-budget-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #334155;
}

.detailed-budget-table tbody tr:hover {
    background: #f8fafc;
}

.budget-amount {
    font-weight: 600;
    color: #10b981;
}

.budget-adr {
    font-weight: 600;
    color: #64748b;
}

.budget-weeks {
    font-weight: 500;
    color: #334155;
}

.budget-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.budget-type-task {
    background: #ede9fe;
    color: #6366f1;
}

.budget-type-milestone {
    background: #fce7f3;
    color: #db2777;
}

/* ==========================================
   RESOURCES VIEW
   ========================================== */

#resourcesView {
    padding: 24px;
}


.btn-resource-action {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin: 0 2px;
    color: #475569;
}

.btn-resource-action:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-delete-resource:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

/* Resource checklist in task bar modal */
.resource-checklist {
    max-height: 150px;
    overflow-y: auto;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    background: #f8fafc;
}

.resource-check-item {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    transition: background 0.1s;
}

.resource-check-item:hover {
    background: #ede9fe;
}

.resource-check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #6366f1;
}

.resource-check-item span {
    line-height: 1;
}

.resource-check-empty {
    color: #94a3b8;
    font-style: italic;
    font-size: 13px;
    padding: 5px;
}

.resource-task-badge {
    display: inline-block;
    background: #ede9fe;
    color: #4f46e5;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    margin: 1px 2px;
    border: 1px solid #ddd6fe;
}

/* ==========================================
   WORKLOAD VIEW
   ========================================== */

#workloadView {
    padding: 24px;
}

.workload-project-dropdown {
    position: relative;
}

.workload-project-toggle {
    min-width: 160px;
    user-select: none;
    transition: all 0.15s;
}

.workload-project-list {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    z-index: 100;
    min-width: 200px;
    max-height: 200px;
    overflow-y: auto;
    padding: 6px;
}

.workload-project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    transition: background 0.1s;
}

.workload-project-item:hover {
    background: #ede9fe;
}

.workload-project-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #6366f1;
}

.workload-month-label {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    min-width: 160px;
    text-align: center;
}

.workload-grid-container {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.workload-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.workload-grid th,
.workload-grid td {
    border: 1px solid #e2e8f0;
}

.workload-resource-header {
    background: #1e293b;
    color: white;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 160px;
    width: 160px;
}

.workload-day-header {
    background: #475569;
    color: #e2e8f0;
    padding: 6px 2px;
    text-align: center;
    font-size: 10px;
    font-weight: 500;
    min-width: 80px;
    width: 80px;
    line-height: 1.3;
}

.workload-day-header.workload-today {
    background: #eab308;
    color: white;
}

.workload-resource-name {
    background: #f8fafc;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 13px;
    color: #0f172a;
    position: sticky;
    left: 0;
    z-index: 1;
    border-right: 1px solid #e2e8f0;
}

.workload-cell {
    padding: 3px;
    vertical-align: top;
    min-height: 40px;
    height: 40px;
    background: white;
}

.workload-cell.workload-today {
    background: #fefce8;
}

.workload-cell.workload-overload {
    background: #fef2f2;
}

.workload-count-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.workload-task-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #10b981;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.workload-task-count.count-2 {
    background: #eab308;
    color: white;
}

.workload-task-count.count-3 {
    background: #f97316;
}

.workload-task-count.count-4plus {
    background: #ef4444;
}

.workload-tooltip {
    display: none;
    position: absolute;
    top: 50%;
    right: calc(100% + 8px);
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 180px;
    max-width: 280px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    font-size: 12px;
    pointer-events: none;
}

.workload-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #1e293b;
}

.workload-count-wrapper:hover .workload-tooltip {
    display: block;
}

.workload-count-wrapper.tooltip-right .workload-tooltip {
    right: auto;
    left: calc(100% + 8px);
}

.workload-count-wrapper.tooltip-right .workload-tooltip::after {
    left: auto;
    right: 100%;
    border-left-color: transparent;
    border-right-color: #1e293b;
}

.workload-tooltip-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workload-tooltip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.workload-task-chip {
    color: white;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================
   AUTH PAGES
   ========================================== */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
    padding: 40px 36px;
    text-align: center;
}

.auth-logo {
    font-size: 32px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 32px;
}

.auth-form h2 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 24px;
}

.auth-form .form-group {
    text-align: left;
}

.auth-btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
}

.auth-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
    text-align: left;
}

.auth-switch {
    margin-top: 20px;
    font-size: 13px;
    color: #64748b;
}

.auth-switch a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* ==========================================
   USER MENU & SHARE
   ========================================== */

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.user-name {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
}

.lang-select {
    height: 30px;
    padding: 0 6px;
    border: 1px solid #475569;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    width: 38px;
}
.lang-select:hover { border-color: #64748b; color: white; }
.lang-select:focus { outline: none; border-color: #64748b; }
.lang-select option { background: #1e293b; color: white; }

.lang-toggle {
    height: 30px;
    padding: 0 10px;
    border: 1px solid #475569;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    letter-spacing: 0.3px;
    transition: border-color 0.2s, color 0.2s;
}
.lang-toggle:hover { border-color: #64748b; color: white; }

.btn-logout {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    background: #334155;
    color: white;
    border-color: #64748b;
}

.btn-share {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-share:hover {
    background: #334155;
    color: white;
    border-color: #64748b;
}

.share-url-container {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.share-url-input {
    flex: 1;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-family: monospace;
    color: #334155;
    background: #f8fafc;
    outline: none;
}

.btn-copy {
    padding: 10px 16px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn-copy:hover {
    background: #4f46e5;
}

.share-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.share-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #6366f1;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Shared view (read-only) banner */
.shared-banner {
    background: #fef3c7;
    color: #92400e;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

/* Share mode selector */
.share-mode-selector {
    display: flex;
    gap: 10px;
    margin: 16px 0 4px;
}

.share-mode-option {
    flex: 1;
    cursor: pointer;
}

.share-mode-option input {
    display: none;
}

.share-mode-card {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.share-mode-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.share-mode-option input:checked + .share-mode-card {
    border-color: #6366f1;
    background: #eef2ff;
}

.share-mode-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.share-mode-desc {
    font-size: 11px;
    color: #94a3b8;
}

/* ==========================================
   PROJECTS VIEW
   ========================================== */

#projectsView {
    padding: 24px;
}


.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.project-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    border: 1.5px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.2s;
}

.project-card:hover {
    border-color: #818cf8;
    box-shadow: 0 4px 20px rgba(99,102,241,0.12);
    transform: translateY(-2px);
}

.project-card-active {
    border-color: #818cf8;
}

.project-card-body {
    padding: 24px 20px 16px;
    cursor: pointer;
}

.project-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
    word-break: break-word;
}

.project-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.project-card-date {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.project-status-badge {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    display: inline-block;
}

.project-status-badge.status-draft {
    background: #f1f5f9;
    color: #64748b;
}

.project-status-badge.status-active {
    background: #dcfce7;
    color: #16a34a;
}

.project-status-badge.status-done {
    background: #ede9fe;
    color: #7c3aed;
}

/* Project edit modal - status selector */
.project-status-selector {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    align-items: stretch;
}

.project-status-option {
    flex: 1;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.project-status-option .project-status-card {
    flex: 1;
}

.project-status-option input {
    display: none;
}

.project-status-card {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    box-sizing: border-box;
}

.project-status-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.project-status-option input:checked + .project-status-card {
    border-color: #6366f1;
    background: #eef2ff;
}

.project-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-draft { background: #94a3b8; }
.status-dot-active { background: #22c55e; }
.status-dot-done { background: #8b5cf6; }

.project-status-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.project-status-desc {
    font-size: 11px;
    color: #94a3b8;
}

.project-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 20px 8px 12px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

.project-card-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.project-card-btn:hover {
    background: #eef2ff;
    color: #6366f1;
}

.project-card-btn-delete:hover {
    background: #fef2f2;
    color: #ef4444;
}

.projects-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 15px;
}

/* Project info in roadmap toolbar (replaces project-selector) */
.project-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-name-display {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Connection Dependencies === */

.connections-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

.connection-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4a90d9;
    border: 2px solid #fff;
    border-radius: 50%;
    opacity: 0;
    cursor: crosshair;
    z-index: 15;
    pointer-events: auto;
    transition: opacity 0.15s;
    box-sizing: border-box;
}

.task-bar:hover .connection-handle,
.milestone:hover .connection-handle,
.connection-handle:hover,
.connection-handle.active {
    opacity: 1;
}

.connection-handle:hover {
    transform: scale(1.3);
    background: #2a6cb9;
}

.connection-handle-left {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-handle-left:hover {
    transform: translateY(-50%) scale(1.3);
}

.connection-handle-right {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.connection-handle-right:hover {
    transform: translateY(-50%) scale(1.3);
}

.connection-handle-bottom {
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
}

.connection-handle-bottom:hover {
    transform: translateX(-50%) scale(1.3);
}

.connection-line {
    fill: none;
    stroke: #888;
    stroke-width: 2;
    pointer-events: stroke;
    cursor: pointer;
    transition: stroke 0.15s;
}

.connection-line:hover {
    stroke: #4a90d9;
    stroke-width: 3;
}

.connection-line.selected {
    stroke: #e74c3c;
    stroke-width: 2.5;
}

.connection-temp-line {
    stroke: #4a90d9;
    stroke-width: 2;
    stroke-dasharray: 5 5;
    pointer-events: none;
}

.connection-drag-active .connection-handle {
    opacity: 1;
}

.connection-drag-active .task-bar,
.connection-drag-active .milestone {
    cursor: crosshair;
}

/* ==========================================
   KANBAN VIEW
   ========================================== */

#kanbanView {
    padding: 24px;
}

.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 24px;
    min-height: calc(100vh - 160px);
    align-items: flex-start;
}

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
}

.kanban-column-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-column-name.editable {
    cursor: pointer;
}

.kanban-column-name-input {
    width: 100%;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
}

.kanban-column-count {
    background: #e2e8f0;
    color: #475569;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.kanban-column-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.kanban-column-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.kanban-column-actions button:hover {
    color: #475569;
    background: #e2e8f0;
}

.kanban-column-actions button.kanban-delete-col:hover {
    color: #ef4444;
    background: #fee2e2;
}

.kanban-cards {
    padding: 0 10px 10px;
    min-height: 60px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-cards.drag-over {
    background: rgba(59, 130, 246, 0.06);
    border-radius: 8px;
}

.kanban-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 12px;
    cursor: grab;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.15s, transform 0.15s;
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.kanban-card.dragging {
    opacity: 0.4;
    transform: rotate(2deg);
}

.kanban-card-color {
    height: 3px;
    border-radius: 2px;
    margin-bottom: 10px;
}

.kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.kanban-card-desc {
    font-size: 12px;
    color: #475569;
    margin-bottom: 6px;
    line-height: 1.4;
    overflow: hidden;
    max-height: 4.2em;
}

.kanban-card-row {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
}

.kanban-card-resources {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.kanban-card-resource {
    font-size: 11px;
    background: #eff6ff;
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* === Collaborators === */

.project-role-badge {
    font-size: 11px;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: auto;
}

.collab-add-form {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.collab-add-form .modal-input {
    flex: 1;
}

.collab-message {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.collab-message.success {
    background: #f0fdf4;
    color: #166534;
}

.collab-message.error {
    background: #fef2f2;
    color: #991b1b;
}

.collab-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.collab-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.collab-info {
    display: flex;
    flex-direction: column;
}

.collab-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.collab-email {
    font-size: 12px;
    color: #64748b;
}

.collab-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    border-radius: 4px;
}

.collab-remove:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* === Export dropdown === */

.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    min-width: 120px;
    overflow: hidden;
}

.export-dropdown-menu.show {
    display: block;
}

.export-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    white-space: nowrap;
}

.export-dropdown-item:hover {
    background: #f1f5f9;
}

/* ==========================================
   RAID VIEW
   ========================================== */

#raidView {
    padding: 24px;
}

.raid-section {
    padding: 0;
    overflow: hidden;
}

/* Filter buttons */
.raid-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-wrap: wrap;
}

.raid-search-input {
    margin-left: auto;
    padding: 5px 10px 5px 28px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 9px center;
    width: 200px;
    outline: none;
    transition: border-color 0.15s, width 0.2s;
}
.raid-search-input:focus {
    border-color: #6366f1;
    width: 260px;
}

.raid-filter-btn {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.raid-filter-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}

.raid-filter-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

/* Table content area */
.raid-table-content {
    padding: 20px;
}

/* Table */
.raid-table {
    width: 100%;
    border-collapse: collapse;
}

.raid-table th {
    background: #1e293b;
    color: white;
    padding: 11px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.raid-table th:first-child { border-radius: 0; }

.raid-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
}

.raid-table tbody tr:hover {
    background: #f8fafc;
}

.raid-table td.raid-title-cell {
    max-width: 200px;
    font-weight: 500;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.raid-table td.raid-desc-cell {
    max-width: 180px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status badges */
.raid-status-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.raid-status-open       { background: #dbeafe; color: #1d4ed8; }
.raid-status-in_progress { background: #ffedd5; color: #c2410c; }
.raid-status-resolved   { background: #dcfce7; color: #15803d; }

/* Priority badges */
.raid-priority-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.raid-priority-high   { background: #fee2e2; color: #b91c1c; }
.raid-priority-medium { background: #fef3c7; color: #92400e; }
.raid-priority-low    { background: #f1f5f9; color: #475569; }

/* Type badges */
.raid-type-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.raid-type-risk       { background: #fee2e2; color: #b91c1c; }
.raid-type-action     { background: #dbeafe; color: #1d4ed8; }
.raid-type-issue      { background: #ffedd5; color: #c2410c; }
.raid-type-dependency { background: #f3e8ff; color: #7c3aed; }

/* Linked-to cell */
.raid-linked-cell {
    font-size: 12px;
    color: #6366f1;
    font-style: italic;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty state */
.raid-empty {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
    font-style: italic;
    font-size: 14px;
}

/* Row action buttons */
.raid-action-btn {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin: 0 2px;
    color: #475569;
}

.raid-action-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.raid-action-btn.raid-delete-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

/* Modal textarea */
.modal-textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.5;
}

/* Two-column form group inside modal */
.form-group-inline {
    display: flex;
    gap: 12px;
}

.form-group-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
