.tree-levels-container {
  position: relative;
}
.tree-level-row {
  display: flex;
  gap: 36px; /* widen spacing to reduce overlaps */
  margin: 30px 0; /* extra vertical space for group lanes */
}

/* Add extra bottom margin on the last level row to keep connectors clear of cards */
.tree-level-row:last-child {
  margin-bottom: 48px;
}
.tree-svg {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}
/* Modern CSS for LiDAR Project Management System */

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

/* Top Navigation */
.top-navigation {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-buttons {
    display: flex;
    gap: 0;
}

.nav-btn {
    background: transparent;
    border: none;
    color: #ecf0f1;
    padding: 15px 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.15);
    border-bottom-color: #3498db;
    color: #ffffff;
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: #3498db;
}

/* Page Container */
.page-container {
    flex: 1;
    overflow: hidden;
}

.page {
    display: none;
    height: 100%;
    overflow: hidden;
}

.page.active {
    display: flex;
    flex-direction: column;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    color: #333;
    overflow: hidden;
}

/* Demo toggle top-right */
.demo-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 3000;
    background: rgba(255,255,255,0.9);
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 6px 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.demo-label { font-size: 12px; color: #555; font-weight: 600; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .2s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%; }
input:checked + .slider { background-color: #1a73e8; }
input:checked + .slider:before { transform: translateX(20px); }

/* Optional: style changes when demo mode is on */
.app-root.demo-enabled .viewport-switcher .switch-btn[data-target="view-project-updates"] { box-shadow: 0 0 0 2px rgba(26,115,232,0.35); }

.app-root { display: flex; flex-direction: column; height: 100vh; background: #f8f9fa; }
.main-row { flex: 1; display: flex; min-height: 0; }
.chat-sidebar { width: 20vw; min-width: 260px; max-width: 420px; display: flex; flex-direction: column; /* remove divider line */ border-right: none; background: transparent; padding: 8px; padding-top: 80px; }
.chat-header { 
    padding: 15px 20px; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    color: #ffffff; 
    border-radius: 12px 12px 0 0; 
    box-shadow: none; 
    margin-bottom: 0; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}
.chat-messages { 
    flex: 1; 
    overflow-y: auto; 
    padding: 12px 16px; 
    background: #ffffff; 
    border: 1px solid #e9ecef; 
    border-top: none; 
    border-radius: 0 0 12px 12px; 
    box-shadow: none; 
}
.view-area { 
    flex: 1; 
    position: relative; 
    background: #ffffff; 
    display: flex; 
    flex-direction: column; 
    padding: 12px; 
    padding-bottom: 92px; 
    border-radius: 12px; 
    box-shadow: 0 2px 12px rgba(0,0,0,0.06); 
    border: 1px solid #e9ecef; 
    margin: 8px; 
    overflow: hidden; 
}
.view-pane { position: absolute; inset: 0; display: none; }
.view-pane.active { display: flex; flex-direction: column; }
.bottom-bars { display: flex; flex-direction: column; gap: 10px; padding: 10px; /* remove top line */ border-top: none; background: linear-gradient(180deg, rgba(255,255,255,0.85), #ffffff); position: sticky; bottom: 0; z-index: 2000; backdrop-filter: blur(4px); }
.viewport-switcher { display: flex; gap: 8px; justify-content: center; background: #ffffff; padding: 8px; border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.switch-btn { padding: 8px 14px; border: 1px solid #e0e0e0; background: #f8f9fa; border-radius: 20px; cursor: pointer; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); transition: all .15s ease; }
.switch-btn:hover { transform: translateY(-1px); }
.switch-btn.active { background: #e7f1ff; border-color: #80bfff; color: #1a73e8; box-shadow: 0 3px 10px rgba(26,115,232,0.25); }
.chat-input-bar { display: flex; gap: 8px; align-items: center; padding: 10px; border: 1px solid #e9ecef; border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.chat-input-bar input { flex: 1; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.chat-input-bar .btn { padding: 8px 12px; }
.chat-input-bar #attach-file { background: #f3f4f6; border: 1px solid #e5e7eb; }
.chat-input-bar #attach-file:hover { background: #e5e7eb; }
.chat-input-bar #send-message { background: #1a73e8; color: #fff; }
.chat-input-bar #send-message:hover { filter: brightness(0.95); }

/* View panes backgrounds */
#view-project-updates .news-feed { height: 100%; }
#view-assembly .assembly-tree { height: 100%; background: #fff; border-left: none; border-right: none; }
#view-procurement .procurement-split { display: flex; flex-direction: column; gap: 12px; height: 100%; padding: 12px; overflow: hidden; }
#view-procurement .procurement-split .map-container { flex: 0 0 300px; min-height: 300px; }
#view-procurement .procurement-split #gantt-container { flex: 1 1 auto; min-height: 0; overflow: auto; }
#view-gantt .gantt-container { height: 100%; }

/* BOM tools */
.bom-pcb-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.bom-pcb-btn { padding: 10px 14px; border: 1px solid #e0e0e0; background: #f8f9fa; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 600; color: #2c3e50; display: flex; justify-content: space-between; align-items: center; }
.bom-pcb-btn:hover { background: #eef5ff; border-color: #bcd4ff; }
.bom-table-wrapper { background: #ffffff; border: 1px solid #e9ecef; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.bom-table { width: 100%; border-collapse: collapse; }
.bom-table th, .bom-table td { padding: 10px 12px; border-bottom: 1px solid #f1f1f1; font-size: 13px; }
.bom-table th { background: #f8f9fa; text-align: left; color: #2c3e50; position: sticky; top: 0; }
.bom-row-actions { display: flex; gap: 8px; }
.bom-action { padding: 6px 10px; font-size: 12px; border-radius: 6px; border: 1px solid #e0e0e0; background: #f3f4f6; color: #6b7280; cursor: not-allowed; }
.bom-action.enabled { background: #e7f1ff; color: #1a73e8; border-color: #bcd4ff; cursor: pointer; }
.bom-action.enabled:hover { background: #d9eaff; }

/* Responsive tweaks */
@media (max-width: 1200px) {
  .chat-sidebar { width: 24vw; }
  .viewport-switcher { flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .main-row { flex-direction: column; }
  .chat-sidebar { width: 100%; max-height: 30vh; }
}

/* Header */

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

/* Side Containers */
.left-side, .right-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 300px;
    flex-shrink: 0;
}

.right-side {
    width: 350px;
}

/* Individual Panels */
.part-info-panel, .map-panel, .chat-panel, .news-panel, .center-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.part-info-panel {
    flex: 1;
    min-height: 0;
}

.map-panel {
    height: 300px;
}

.chat-panel {
    height: 300px;
}

.news-panel {
    flex: 1;
    min-height: 0;
}

.center-panel {
    flex: 1;
    min-width: 0;
}

/* Panel Headers */
.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
}

.panel-content {
    padding: 20px;
    height: calc(100% - 60px);
    overflow-y: auto;
}

/* 3D Model Viewer */
.viewer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.model-viewer {
    flex: 1;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.viewer-controls {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 20px;
    /* remove separator line */ border-top: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.model-uploader {
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-uploader button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #007bff;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.model-uploader button:hover {
    background: #0056b3;
}

.upload-status {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.upload-status.error {
    color: #dc3545;
}

.upload-status.success {
    color: #28a745;
}

.viewer-info {
    font-size: 14px;
    color: #666;
}

.viewer-rotation-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 20px;
}

.btn-rotation {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-rotation:hover {
    background: #e9ecef;
    border-color: #999;
    transform: translateY(-1px);
}

.btn-rotation:active {
    transform: translateY(0);
    background: #dee2e6;
}

/* Axis-specific colors matching Three.js AxesHelper */
#rotate-x-btn {
    background: #ff4444;
    color: white;
    border-color: #cc0000;
}

#rotate-x-btn:hover {
    background: #ff6666;
    border-color: #ff0000;
}

#rotate-x-btn:active {
    background: #cc0000;
}

#rotate-y-btn {
    background: #44ff44;
    color: white;
    border-color: #00cc00;
}

#rotate-y-btn:hover {
    background: #66ff66;
    border-color: #00ff00;
}

#rotate-y-btn:active {
    background: #00cc00;
}

#rotate-z-btn {
    background: #4444ff;
    color: white;
    border-color: #0000cc;
}

#rotate-z-btn:hover {
    background: #6666ff;
    border-color: #0000ff;
}

#rotate-z-btn:active {
    background: #0000cc;
}

/* Part Information */
.part-info {
    height: 100%;
}

.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-style: italic;
}

.part-details {
    animation: fadeIn 0.3s ease-in;
}

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

.part-header {
    border-bottom: 2px solid #667eea;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.part-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.part-id {
    font-size: 1rem;
    color: #667eea;
    font-weight: 500;
}

.part-category {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-top: 10px;
}

.info-section {
    margin-bottom: 25px;
}

.info-section h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: #667eea;
    border-radius: 2px;
}

.ticket-item, .supplier-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

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

.ticket-id {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.ticket-type {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    margin-left: 8px;
}

.ticket-description {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

.supplier-name {
    font-weight: 600;
    color: #2c3e50;
}

.quote-info {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Project Instructions Section removed */

/* Chat Section - styles moved to right panel section */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
}

.chat-message {
    margin-bottom: 15px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.message-user {
    font-weight: 600;
    color: #2c3e50;
}

.message-time {
    font-size: 0.8rem;
    color: #666;
}

.message-content {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    color: #333;
}

.message-content.ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

/* Typing Animation */
.typing-message {
    opacity: 0.8;
}

.typing-indicator {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 16px !important;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input input:focus {
    border-color: #667eea;
}

/* News Section - styles moved to right panel section */

.news-feed {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Removed timed news auto-focus styles */

/* DEMO: Focus style without dimming the rest */
.app-root.demo-click-enabled .demo-focus { position: relative; z-index: 1; outline: 2px solid rgba(26,115,232,0.6); box-shadow: 0 0 0 3px rgba(26,115,232,0.2); }
#demo-dim-overlay { display: none !important; }
.app-root.demo-click-enabled.demo-dim-all #demo-dim-overlay { display: none !important; }

/* Remove class-based dimming in demo mode */
.demo-dim { filter: none !important; opacity: 1 !important; }

.news-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
    animation: fadeInUp 0.3s ease-out;
}

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

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

.news-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.news-content {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.news-author {
    font-weight: 700;
    color: #1a73e8;
    background: #e7f1ff;
    padding: 1px 6px;
    border-radius: 10px;
    margin-right: 6px;
}

.news-timestamp {
    font-size: 0.8rem;
    color: #999;
}

.news-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    margin-left: 8px;
}

.news-type.issue_resolved { background: #d4edda; color: #155724; }
.news-type.procurement { background: #cce5ff; color: #004085; }
.news-type.testing { background: #fff3cd; color: #856404; }

/* News badges */
.news-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    margin-left: 8px;
    font-weight: 700;
}

.news-badge.attention-required {
    background: #dc3545;
    color: #ffffff;
}

.news-badge.as-planned {
    background: #28a745;
    color: #ffffff;
}

.news-badge.discussion-ongoing {
    background: #ffc107;
    color: #212529;
}

/* Map Section */
.map-controls {
    display: flex;
    gap: 5px;
}

.map-controls .btn {
    padding: 4px 8px;
    font-size: 12px;
}

.map-container {
    flex: 1;
    position: relative;
}

.map {
    width: 100%;
    height: 100%;
}

/* Route Visualization Styles */
.route-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-width: 250px;
}

.route-popup h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

.route-popup p {
    margin: 5px 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.route-popup strong {
    color: #2c3e50;
    font-weight: 600;
}

.route-label {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #667eea;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.route-label-text {
    white-space: nowrap;
}

/* Assembly Diagram Page */
.assembly-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}


.assembly-content {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
    height: calc(100vh - 120px);
}

.assembly-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 300px;
    flex: 0 0 300px;
}

.highlights-panel {
    width: 250px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.highlights-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.highlight-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.highlight-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
}

.highlight-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.assembly-diagram {
    flex: 1 1 auto;
    min-width: 0;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: auto;
}

.task-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow: auto;
}

.task-panel h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.task-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 12px;
    margin: 8px 0;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #e9ecef;
}

.task-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-name {
    font-weight: 500;
    color: #2c3e50;
    flex: 1;
}

.task-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.task-meta-dates {
    font-size: 12px;
    color: #6c757d;
}

.task-comment {
    font-size: 13px;
    color: #2c3e50;
    line-height: 1.3;
}

/* Embedded tasks in assembly nodes */
.node-tasks {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.node-tasks .task-item {
    margin: 6px 0;
    padding: 10px 12px;
    font-size: 13px;
}

.node-tasks .task-name {
    font-size: 11px;
    font-weight: 500;
}

.node-tasks .task-status {
    font-size: 10px;
    padding: 2px 6px;
}

.node-tasks .task-meta-dates {
    font-size: 10px;
    color: #6c757d;
}

.node-tasks .task-comment {
    font-size: 10px;
    color: #2c3e50;
    line-height: 1.2;
}

.status-complete {
    background: #d4edda;
    color: #155724;
}

.status-in-progress {
    background: #cce5ff;
    color: #004085;
}

.status-closed {
    background: #d4edda;
    color: #155724;
}

.assembly-tree {
    min-height: 400px;
    padding: 20px;
    overflow: auto; /* keep scrollbars */
    white-space: nowrap;
}

.tree-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.branches-container {
    display: flex;
    gap: 50px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.tree-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
}

.children-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

/* Level-based tree layout */
.tree-levels-container {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    gap: 40px;
    align-items: stretch;
}

.tree-level-row {
    display: inline-flex;
    gap: 24px;
    justify-content: center;
    align-items: flex-start;
}

.level-node {
    position: relative;
}

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

.tree-branch::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 15px;
    background: #dee2e6;
    z-index: 1;
}

.tree-branch:first-child::before {
    display: none;
}

/* Assembly Node Styles */
.assembly-node {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 18px;
    margin: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    min-width: 200px;
    cursor: pointer;
}

.assembly-node.selected {
    background: #fff3cd;
    border-color: #ffc107;
}

.assembly-node.has-issues {
    background: #f8d7da;
    border-color: #dc3545;
}

.assembly-node.has-redlines {
    background: #fff3cd;
    border-color: #ffc107;
}

/* Tree connection lines */
.tree-branch > .assembly-node::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 15px;
    background: #dee2e6;
    z-index: 1;
}

.tree-branch:last-child > .assembly-node::after {
    display: none;
}

.assembly-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.assembly-node.has-issues {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.assembly-node.has-redlines {
    border-color: #f39c12;
    background: #fef9e7;
}

.assembly-node.out-of-date {
    border-color: #9b59b6;
    background: #f4f0f7;
}

.node-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.node-image {
    width: 40px;
    height: 40px;
    background: #ecf0f1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #7f8c8d;
}

.node-info h4 {
    color: #2c3e50;
    font-size: 14px;
    margin: 0;
}

.node-revision {
    color: #7f8c8d;
    font-size: 12px;
}

.node-metrics {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.metric {
    text-align: center;
}

.metric-label {
    font-size: 10px;
    color: #7f8c8d;
    text-transform: uppercase;
}

.metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.metric-value.has-issues {
    color: #e74c3c;
}

.metric-value.has-redlines {
    color: #f39c12;
}

/* Task Status Styles */
.node-tasks {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
}

.task-name {
    color: #555;
}

.task-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-complete {
    background: #d4edda;
    color: #155724;
}

.status-in-progress {
    background: #cce5ff;
    color: #004085;
}

.status-closed {
    background: #d1ecf1;
    color: #0c5460;
}

/* Procurement Page */
.procurement-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}


.procurement-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

.procurement-map {
    height: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.procurement-map .panel-header {
    flex-shrink: 0;
    height: 50px;
}

.procurement-map .map-container {
    flex: 1;
    height: calc(100% - 50px);
    position: relative;
}

.procurement-map .map {
    width: 100%;
    height: 100%;
    min-height: 250px;
}

.gantt-chart {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.gantt-container {
    height: 100%;
    overflow: auto;
    padding: 0 20px 20px 20px;
    position: relative;
    background: white;
}
/* Sticky banner anchored to left edge of the scroll container */
.gantt-sticky-banner {
    position: sticky;
    top: 0;
    left: 0;
    height: 50px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    z-index: 1001;
}

.gantt-container::before {
    content: '';
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #f8f9fa;
    z-index: 1001;
    margin: 0; /* ensure full width, unaffected by horizontal scroll */
    width: 100%;
    display: block;
    border-bottom: 1px solid #e9ecef;
    pointer-events: none;
}

/* Gantt Chart Styles */
.gantt-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    left: 0; /* anchor to left within scroll container */
    z-index: 1002;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background-color: #f8f9fa;
    margin: 0; /* keep aligned */
    padding: 0;
    height: 50px;
    min-width: 100%;
}

.gantt-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa;
    z-index: -1;
}

/* unify sticky banner behavior; full width and non-horizontal moving */
.gantt-container::before {
    content: '';
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #f8f9fa;
    z-index: 1002;
    margin: 0;
    display: block;
    border-bottom: 1px solid #dee2e6;
    width: 100%;
    box-sizing: border-box; /* make width match gantt-container including padding */
    padding: 0 20px; /* mirror gantt-container horizontal padding */
    pointer-events: none;
}

.gantt-header {
    position: sticky;
    top: 50px;
    z-index: 1001;
    background: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gantt-header-cell {
    padding: 8px 4px;
    border-right: 1px solid #e9ecef;
    font-weight: 600;
    color: #2c3e50;
    font-size: 12px;
    text-align: center;
    min-width: 30px;
    background: #f8f9fa;
    position: relative;
    z-index: 1003;
}

.gantt-header-cell.part-info {
    min-width: 120px;
    text-align: left;
}

.gantt-header-cell.date-cell {
    min-width: 30px;
    font-size: 10px;
}

.gantt-row {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    min-height: 50px;
    align-items: stretch;
    position: relative;
    z-index: 1;
    background: white;
}

.gantt-row:hover {
    background: #f8f9fa;
}

.gantt-cell {
    padding: 8px 4px;
    border-right: 1px solid #e9ecef;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gantt-cell.part-info {
    min-width: 120px;
    justify-content: flex-start;
    font-size: 12px;
}

.gantt-cell.timeline-cell {
    min-width: 30px;
    padding: 0;
    position: relative;
}

.gantt-task {
    background: #e74c3c;
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 10px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1;
}

.gantt-task:hover {
    transform: scale(1.05);
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gantt-task.manufacturing {
    background: #e74c3c;
}

.gantt-task.procurement {
    background: #3498db;
}

.gantt-task.logistics {
    background: #27ae60;
}

/* Ensure continuous timeline with no gaps */
.gantt-row .timeline-cell:not(:empty) {
    background: transparent;
}

.gantt-row .timeline-cell:empty {
    background: #ffffff;
}

/* Version Tree Page */
.version-tree-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.version-tree-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden; /* keep single-viewport layout (no inner scroll) */
}

.git-visualization {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-height: calc(100vh - 120px);
}

.git-tree {
    position: relative;
    min-height: 800px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    padding: 20px;
    background: #f8f9fa;
}

/* Git graph container */
.git-graph-container {
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 40px 20px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    min-height: 600px;
    height: 100%;
    overflow: visible; /* fit into viewport, no inner scroll */
}

.git-branch-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2; /* ensure lines sit above background but below info boxes */
}

.git-graph-item { 
    position: absolute;
    left: 0;
    right: 0;
    height: 80px;
    display: flex;
    align-items: center;
    z-index: 3; /* lift boxes above lines */
}

.git-commit-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 3px solid #28a745;
    background: white;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.git-commit-circle.main {
    border-color: #28a745;
    background: #28a745;
}

.git-commit-info {
    position: absolute;
    left: calc(50% + 30px);
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    min-width: 200px;
}

.git-hash {
    font-weight: bold;
    color: #6c757d;
    font-size: 12px;
    margin-bottom: 2px;
}

.git-fallback {
    padding: 40px;
    text-align: center;
    color: #6c757d;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* Main branch vertical line */
.git-main-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #28a745;
    z-index: 1;
    transform: translateX(-50%);
}

/* Git graph container */
.git-graph {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Commit node */
.git-commit-node {
    position: relative;
    margin: 15px 0;
    z-index: 2;
    min-height: 60px;
}

/* Commit circle */
.git-commit-circle {
    position: absolute;
    left: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 3px solid #28a745;
    background: white;
    z-index: 3;
    transform: translateX(-50%);
}

/* Branch fork */
.git-branch-fork {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid;
    background: white;
    z-index: 3;
}

.git-branch-fork.feature-optical {
    border-color: #ffc107;
}

.git-branch-fork.feature-pcb {
    border-color: #17a2b8;
}

.git-branch-fork.feature-mechanical {
    border-color: #dc3545;
}

.git-branch-fork.feature-power {
    border-color: #6f42c1;
}

.git-branch-fork.feature-holder {
    border-color: #fd7e14;
}

.git-branch-fork.feature-rotating {
    border-color: #20c997;
}

.git-branch-fork.feature-driver {
    border-color: #e83e8c;
}

/* Branch line (horizontal) */
.git-branch-line {
    position: absolute;
    top: 50%;
    height: 2px;
    background: #333;
    z-index: 2;
}

.git-branch-line.feature-optical {
    background: #ffc107;
}

.git-branch-line.feature-pcb {
    background: #17a2b8;
}

.git-branch-line.feature-mechanical {
    background: #dc3545;
}

.git-branch-line.feature-power {
    background: #6f42c1;
}

.git-branch-line.feature-holder {
    background: #fd7e14;
}

.git-branch-line.feature-rotating {
    background: #20c997;
}

.git-branch-line.feature-driver {
    background: #e83e8c;
}

/* Branch content */
.git-branch-content {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid;
    margin-left: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.git-branch-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.git-branch-content.feature-optical {
    border-left-color: #ffc107;
}

.git-branch-content.feature-pcb {
    border-left-color: #17a2b8;
}

.git-branch-content.feature-mechanical {
    border-left-color: #dc3545;
}

.git-branch-content.feature-power {
    border-left-color: #6f42c1;
}

.git-branch-content.feature-holder {
    border-left-color: #fd7e14;
}

.git-branch-content.feature-rotating {
    border-left-color: #20c997;
}

.git-branch-content.feature-driver {
    border-left-color: #e83e8c;
}

/* Merge commit */
.git-merge-commit {
    position: absolute;
    left: -50px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 3px solid #6c757d;
    background: white;
    z-index: 3;
}

/* Merge line */
.git-merge-line {
    position: absolute;
    top: 50%;
    height: 2px;
    background: #6c757d;
    z-index: 2;
}

.git-branch:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.git-branch.main {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.git-branch.merged {
    border-left-color: #6c757d;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.git-branch.active {
    border-left-color: #007bff;
    background: linear-gradient(135deg, #cce7ff 0%, #b3d9ff 100%);
}

.git-branch.feature-optical {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.git-branch.feature-pcb {
    border-left-color: #17a2b8;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

.git-branch.feature-mechanical {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.git-branch.feature-power {
    border-left-color: #6f42c1;
    background: linear-gradient(135deg, #e2d9f3 0%, #d1c4e9 100%);
}

.git-branch.feature-holder {
    border-left-color: #fd7e14;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
}

.git-branch.feature-rotating {
    border-left-color: #20c997;
    background: linear-gradient(135deg, #d1f2eb 0%, #a7f3d0 100%);
}

.git-branch.feature-driver {
    border-left-color: #e83e8c;
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
}

.branch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.branch-name {
    font-weight: bold;
    font-size: 18px;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.branch-status {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.branch-status.merged {
    background: #6c757d;
    color: white;
}

.branch-status.active {
    background: #007bff;
    color: white;
}

.branch-parent {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.git-commits {
    margin-left: 20px;
}

.git-commit {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 10px;
    background: rgba(255,255,255,0.8);
    border-radius: 6px;
    border-left: 3px solid #dee2e6;
    transition: all 0.2s ease;
}

.git-commit:hover {
    background: rgba(255,255,255,1);
    transform: translateX(8px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.commit-hash {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
    margin-right: 12px;
    min-width: 90px;
    font-weight: bold;
}

.commit-message {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.commit-ticket {
    background: #007bff;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 10px;
    text-transform: uppercase;
}

.commit-date {
    font-size: 11px;
    color: #666;
    margin-left: 10px;
    min-width: 80px;
}

.commit-author {
    font-size: 11px;
    color: #666;
    margin-left: 10px;
    font-style: italic;
    min-width: 100px;
}

/* Branch Legend */
.git-legend {
    position: fixed;
    top: 100px;
    right: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 220px;
    border: 1px solid #e9ecef;
}

.git-legend h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.legend-item:hover {
    background: #f8f9fa;
}

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    margin-right: 10px;
    border-left: 4px solid;
}

.legend-color.main { border-left-color: #28a745; }
.legend-color.merged { border-left-color: #6c757d; }
.legend-color.active { border-left-color: #007bff; }
.legend-color.feature-optical { border-left-color: #ffc107; }
.legend-color.feature-pcb { border-left-color: #17a2b8; }
.legend-color.feature-mechanical { border-left-color: #dc3545; }
.legend-color.feature-power { border-left-color: #6f42c1; }
.legend-color.feature-holder { border-left-color: #fd7e14; }
.legend-color.feature-rotating { border-left-color: #20c997; }
.legend-color.feature-driver { border-left-color: #e83e8c; }

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-highlight {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    animation: pulse-highlight 2s infinite;
}

.btn-highlight:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

@keyframes pulse-highlight {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(245, 87, 108, 0.6);
    }
}

/* Server folder modal styles */
.server-folder-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.server-folder-modal__dialog {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.server-folder-modal__header {
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.server-folder-modal__header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.server-folder-modal__close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.server-folder-modal__close:hover {
    background: #f0f0f0;
}

.server-folder-modal__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.server-folder-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.server-folder-item {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.server-folder-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.server-folder-item.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.server-folder-item__name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.server-folder-item__info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
}

.server-folder-item__badge {
    padding: 2px 8px;
    border-radius: 12px;
    background: #e9ecef;
    color: #555;
}

.server-folder-item__badge.has-data {
    background: #d4edda;
    color: #155724;
}

.server-folder-item__badge.initialized {
    background: #cce5ff;
    color: #004085;
}

.server-folder-modal__footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
    flex-direction: column;
    gap: 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 250px 1fr 300px;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr 1fr;
    }
    
    .app-container {
        grid-template-rows: 60px 1fr 150px;
    }
}

.news-item.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.25);
}

/* ---------- Ticket Modal (Jira-style) ---------- */
.ticket-modal { position: fixed; inset: 0; z-index: 5000; }
.ticket-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); }
.ticket-modal__dialog { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80vw; max-width: 1100px; max-height: 80vh; background: #fff; border-radius: 10px; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.25); overflow: hidden; }
.ticket-modal__header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #e9ecef; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; }
.ticket-modal__breadcrumbs { font-size: 12px; opacity: 0.9; }
.ticket-modal__title { flex: 1; font-size: 18px; font-weight: 700; }
.ticket-modal__close { background: transparent; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; }
.ticket-modal__body { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; padding: 16px; overflow: auto; }
.ticket-modal__left { display: flex; flex-direction: column; gap: 16px; }
.ticket-modal__right { border-left: 1px solid #f1f3f5; padding-left: 16px; }
.ticket-modal__meta { display: flex; flex-wrap: wrap; gap: 10px; background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; padding: 10px; }
.ticket-modal__description { background: #fff; border: 1px solid #e9ecef; border-radius: 8px; padding: 12px; }
.ticket-modal__description h4, .ticket-modal__comments h4 { margin-bottom: 8px; color: #2c3e50; }
.ticket-modal__comments { background: #fff; border: 1px solid #e9ecef; border-radius: 8px; padding: 12px; }
.ticket-comments .ticket-comment { border-top: 1px solid #f1f3f5; padding: 8px 0; }
.ticket-comments .ticket-comment:first-child { border-top: none; }
.ticket-comment .hdr { display: flex; justify-content: space-between; font-size: 12px; color: #6c757d; margin-bottom: 4px; }
.ticket-comment .body { font-size: 14px; color: #2c3e50; white-space: pre-wrap; }
.ticket-comments-empty { color: #6c757d; font-style: italic; }
.ticket-add-comment { display: flex; gap: 8px; margin-top: 10px; }
.ticket-add-comment input { flex: 1; padding: 8px 10px; border: 1px solid #dee2e6; border-radius: 6px; }
.ticket-modal__properties .ticket-prop { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f3f5; font-size: 14px; }
.ticket-modal__properties .ticket-prop:last-child { border-bottom: none; }
.ticket-modal__properties .k { color: #6c757d; }
.ticket-modal__properties .v { color: #2c3e50; font-weight: 600; }
.ticket-modal__footer { padding: 10px 16px; border-top: 1px solid #e9ecef; background: #fff; display: flex; justify-content: flex-end; gap: 8px; }
.ticket-status.badge { background: #e7f1ff; color: #1a73e8; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 700; }

body.modal-open { overflow: hidden; }

/* New comment highlight (2.5s yellow fade) */
@keyframes ticketCommentFlash {
    0% { background-color: #fff3cd; }
    100% { background-color: transparent; }
}
.ticket-comment.flash-once {
    animation: ticketCommentFlash 2.5s ease-out 1;
}

/* Markdown content styling for AI responses */
.markdown-content {
    line-height: 1.6;
}

.markdown-content ol,
.markdown-content ul {
    padding-left: 1.25rem;
    list-style-position: inside;
    margin-left: 0;
    margin-bottom: 0.5em;
}

.markdown-content li {
    margin-left: 0;
    margin-bottom: 0.25em;
}

.markdown-content p {
    margin: 0.4em 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 0.8em;
    margin-bottom: 0.4em;
    font-weight: 600;
}

.markdown-content code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    text-align: left;
}

.markdown-content th {
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
}

/* Authentication UI */
.auth-toolbar {
    position: fixed;
    top: 16px;
    left: 16px;
    display: none;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(18, 18, 18, 0.65);
    color: #fff;
    backdrop-filter: blur(6px);
    z-index: 3000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.auth-toolbar--active {
    display: flex;
}

.auth-toolbar__user {
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-compact {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(102,126,234,0.3), rgba(0,0,0,0.85));
    z-index: 9999;
    padding: 20px;
}

.auth-panel {
    width: 100%;
    max-width: 360px;
    background: #10121a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.45);
    color: #f5f6fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-panel h2 {
    margin: 0;
    font-size: 1.4rem;
}

.auth-panel__subtitle {
    margin: -8px 0 8px 0;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.7);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
}

.auth-field input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #fff;
    transition: border-color 0.2s ease;
}

.auth-field input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
}

.auth-error {
    margin: 0;
    font-size: 0.85rem;
    color: #ff6b6b;
}

.auth-submit {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    font-size: 1rem;
}

/* ---------- Manager Letter Modal ---------- */
.manager-letter-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manager-letter-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
}

.manager-letter-dialog {
    position: relative;
    width: 90%;
    max-width: 560px;
    background: linear-gradient(145deg, #fefefe 0%, #f8f5f0 100%);
    border-radius: 4px;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(139, 90, 43, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
    animation: letterSlideIn 0.4s ease-out;
    font-family: 'Georgia', 'Times New Roman', serif;
}

@keyframes letterSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.manager-letter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 28px 16px;
    border-bottom: 2px solid #d4a574;
    background: linear-gradient(180deg, rgba(212, 165, 116, 0.15) 0%, transparent 100%);
}

.manager-letter-icon {
    font-size: 28px;
}

.manager-letter-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #5c3d2e;
    font-style: italic;
    letter-spacing: 0.5px;
}

.manager-letter-body {
    padding: 24px 32px;
    color: #3d2914;
    line-height: 1.7;
    font-size: 1rem;
    background: 
        repeating-linear-gradient(
            transparent 0px,
            transparent 27px,
            rgba(139, 90, 43, 0.08) 27px,
            rgba(139, 90, 43, 0.08) 28px
        );
}

.manager-letter-greeting {
    font-size: 1.1rem;
    font-weight: 600;
    color: #5c3d2e;
    margin-bottom: 16px !important;
}

.manager-letter-body p {
    margin: 0 0 14px 0;
}

.manager-letter-tasks {
    margin: 18px 0;
    padding-left: 24px;
    list-style-type: decimal;
}

.manager-letter-tasks li {
    margin-bottom: 14px;
    padding-left: 6px;
}

.manager-letter-tasks li strong {
    color: #8b4513;
}

.manager-letter-signature {
    margin-top: 24px !important;
    margin-bottom: 0 !important;
    font-style: italic;
    color: #5c3d2e;
}

.manager-letter-signature strong {
    font-size: 1.15rem;
    display: inline-block;
    margin-top: 4px;
    font-family: 'Brush Script MT', cursive, Georgia, serif;
    font-weight: normal;
    letter-spacing: 1px;
}

.manager-letter-footer {
    padding: 16px 28px 20px;
    display: flex;
    justify-content: center;
    background: linear-gradient(0deg, rgba(212, 165, 116, 0.1) 0%, transparent 100%);
    border-top: 1px solid rgba(139, 90, 43, 0.15);
}

.manager-letter-footer .btn {
    min-width: 120px;
    padding: 10px 32px;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border-radius: 6px;
    background: linear-gradient(135deg, #8b5a2b 0%, #6b4423 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.3);
}

.manager-letter-footer .btn:hover {
    background: linear-gradient(135deg, #9b6a3b 0%, #7b5433 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(107, 68, 35, 0.4);
}

/* Goal Instruction Modal (uses manager-letter-modal styles with overrides) */
.goal-dialog {
    max-width: 480px;
    background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.goal-dialog .manager-letter-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
}

.goal-dialog .manager-letter-header h3 {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.goal-dialog .manager-letter-body {
    padding: 28px 32px;
}

.goal-instruction-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #334155;
    text-align: center;
    margin: 0;
}

.goal-instruction-text strong {
    color: #2563eb;
    font-weight: 600;
}

.goal-dialog .manager-letter-footer {
    background: linear-gradient(0deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
    border-top: 1px solid rgba(59, 130, 246, 0.15);
}

.goal-dialog .manager-letter-footer .btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.goal-dialog .manager-letter-footer .btn:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* Under Construction Overlay */
.under-construction-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    pointer-events: none;
}

.under-construction-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 60px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 2px dashed #e0a800;
}

.construction-icon {
    font-size: 48px;
    animation: bounce 2s infinite;
}

.construction-text {
    font-size: 24px;
    font-weight: 600;
    color: #6b4423;
    letter-spacing: 2px;
    text-transform: uppercase;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

