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

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Loading Skeleton Animations */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
}

.skeleton-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    opacity: 0.7;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 4px;
}

.skeleton-text.large {
    height: 24px;
}

.skeleton-text.small {
    height: 12px;
}

.skeleton-chart {
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 8px;
}

/* Fade-in animation disabled for slider to prevent flickering */
.fade-in {
    /* animation: fadeIn 0.5s ease-in; */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1e3a8a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    flex-direction: column;
    gap: 1rem;
}

.loading-text {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Mobile Blocking Popup */
.mobile-block-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.mobile-block-overlay.active {
    display: flex;
}

.mobile-block-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 90%;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.mobile-block-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #ef4444;
}

.mobile-block-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.mobile-block-message {
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.mobile-block-devices {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.device-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.device-icon {
    font-size: 2rem;
    color: #10b981;
}

.header {
    background: #ffffff;
    color: #1e3a8a;
    padding: 0.75rem 2rem;
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100vw;
    box-sizing: border-box;
    height: 90px;
    min-height: 90px;
    max-height: 90px;
    gap: 1rem;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 1px;
}

.header-logo {
    height: 68px;
    width: auto;
    object-fit: contain;
    justify-self: start;
}

.header-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.dashboard-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0;
    text-align: center;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    justify-self: end;
}

.btn-back,
.btn-management {
    background: #e8f0fe;
    color: #1e3a8a;
    border: 1px solid #1e3a8a;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-back:hover,
.btn-management:hover {
    background: #1e3a8a;
    color: white;
}

.header-time {
    font-size: 0.85rem;
    color: #1e3a8a;
    font-weight: 500;
    white-space: nowrap;
}

.tabs {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100vw;
    box-sizing: border-box;
}

.tab-buttons {
    display: flex;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 2rem;
}

.tab-button {
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: #1e3a8a;
    border-bottom-color: #1e3a8a;
    background: #f8fafc;
}

.tab-button:hover {
    background: #f1f5f9;
    color: #1e40af;
}

.container {
    max-width: none;
    width: 100vw;
    margin: 0;
    padding: 0;
    transition: all 0.3s ease;
}

/* Full-screen display mode for panels */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f5f7fa;
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fullscreen-mode .header {
    position: relative;
    z-index: 1001;
}

.fullscreen-mode .container {
    max-width: none;
    width: 100%;
    height: calc(100vh - 90px);
    margin: 0;
    padding: 1rem;
    overflow: hidden;
}

.fullscreen-mode .buildings-grid {
    height: 100%;
    overflow-y: auto;
    padding: 1rem 0;
}

.fullscreen-mode .lines-grid {
    height: 100%;
    overflow-y: auto;
    padding: 1rem 0;
}

.slide-container {
    height: 100%;
    overflow: hidden;
    position: relative;
}

.slide-item {
    height: 100%;
    width: 100%;
    display: none;
    overflow-y: auto;
}

.slide-item.active {
    display: block;
}

.slide-progress {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 1002;
    display: none;
}

.fullscreen-mode .slide-progress {
    display: block;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.buildings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    grid-auto-rows: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

.building-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 200px;
}

.building-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.hq-chart-card {
    background: white;
    border-radius: 0;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    border-left: none;
    border-right: none;
    overflow: hidden;
    transition: none;
}

.hq-chart-card:hover {
    transform: none;
    box-shadow: none;
}

.chart-card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
}

.chart-card-header h3 {
    color: #1e3a8a;
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.chart-summary {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.summary-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #1e3a8a;
    margin-bottom: 0.25rem;
}

.summary-label {
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.building-header {
    background: #1e3a8a;
    color: white;
    padding: 0.75rem;
    cursor: pointer;
    position: relative;
}

.building-status-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 100%;
    border-radius: 0 8px 0 0;
}

.status-production {
    background: #10b981; /* Green - Emerald */
}

.status-maintenance {
    background: #f59e0b; /* Amber - Orange */
}

.status-down {
    background: #ef4444; /* Red */
}

.status-mixed {
    background: #f59e0b;
}

.building-status-text {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.building-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.building-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    font-size: 1.0rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.stat-label {
    opacity: 0.9;
}

.lines-container {
    padding: 0.75rem;
    display: none;
    flex: 1;
}

.lines-container.expanded {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.lines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.75rem;
    flex: 1;
    align-items: start;
}

.line-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.line-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

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

.line-name {
    font-weight: 600;
    color: #1e3a8a;
}

.line-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.production-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.metric {
    text-align: center;
}

.metric-value {
    font-size: 1.6rem;
    font-weight: bold;
    color: #1f2937;
}

.metric-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.efficiency-quality {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.efficiency-quality div {
    text-align: center;
}

.efficiency-value, .quality-value, .downtime-value {
    font-weight: bold;
    font-size: 1.3rem;
}

/* Dynamic colors based on performance */
.efficiency-high, .quality-high { color: #10b981; }
.efficiency-medium, .quality-medium, .downtime-low { color: #f59e0b; }
.efficiency-low, .quality-low, .downtime-high { color: #ef4444; }
.downtime-medium { color: #f59e0b; }

.timeline-container {
    height: 40px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.part-info {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: auto;
}

.status-running { background-color: #4CAF50; color: white; }
.status-down { background-color: #F44336; color: white; }
.status-part_change { background-color: #FF9800; color: white; }
.status-maintenance { background-color: #2196F3; color: white; }
.status-idle { background-color: #9E9E9E; color: white; }
.status-setup { background-color: #FFEB3B; color: black; }

.hq-summary {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

/* Building Detail Page Styles */
.building-detail-page {
    padding: 1rem 2rem;
    max-width: 100%;
    margin: 0 auto;
    height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.building-detail-header {
    margin-bottom: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.building-detail-title h1 {
    color: #1e3a8a;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.line-cards-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.line-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.8rem;
    align-items: stretch;
    align-content: start;
    flex: 1;
    height: 100%;
    overflow: hidden;
    padding: 0;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

/* Prevent initial flicker */
.line-cards-grid:empty {
    opacity: 0;
}

.line-cards-grid.loading {
    opacity: 0.7;
}

/* Professional Loading Skeleton */
.skeleton-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.skeleton-card > div:last-child {
    margin-top: auto;
    background: rgba(30, 58, 138, 0.1);
    margin: auto -0.8rem -0.8rem -0.8rem;
    padding: 0.5rem 0.8rem;
    border-radius: 0 0 6px 6px;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-line {
    background: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    animation: skeleton-pulse 1.5s ease-in-out infinite alternate;
}

.skeleton-line.header {
    height: 20px;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-line.metrics {
    height: 16px;
    width: 45%;
    display: inline-block;
    margin-right: 1rem;
}

.skeleton-line.timeline {
    height: 28px;
    width: 100%;
    margin: 1rem 0;
    background: #d1d5db;
}

.skeleton-line.text {
    height: 12px;
    width: 80%;
}

.skeleton-line.text.short {
    width: 40%;
}

@keyframes skeleton-loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes skeleton-pulse {
    0% { opacity: 1; }
    100% { opacity: 0.5; }
}

.line-detail-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    box-sizing: border-box;
    overflow: hidden;
    will-change: height, opacity;
    contain: layout style;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.line-detail-card.loaded {
    opacity: 1;
}

.line-detail-card:hover {
    /* No hover effect - keep original appearance */
}

/* Compact styling for building detail cards */
.line-detail-card .line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.line-detail-card .line-name {
    font-weight: 600;
    color: #1e3a8a;
    font-size: 0.9rem;
}

.line-detail-card .line-status-badge {
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.line-detail-card .production-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.line-detail-card .metric {
    text-align: center;
}

.line-detail-card .metric-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #1f2937;
    line-height: 1.2;
}

.line-detail-card .metric-label {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 0.2rem;
}

.line-detail-card .efficiency-quality {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
    font-size: 0.75rem;
}

.line-detail-card .efficiency-quality div {
    text-align: center;
}

.line-detail-card .efficiency-value,
.line-detail-card .quality-value,
.line-detail-card .downtime-value {
    font-weight: bold;
    font-size: 1rem;
    line-height: 1.2;
}

.line-detail-card .detailed-timeline-bar {
    height: 32px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.6rem;
    flex-shrink: 0;
    border: 1px solid #d1d5db;
    position: relative;
    min-height: 32px;
}

/* Line and Part Info Footer */
.line-detail-card .card-footer {
    margin: auto -0.8rem -0.8rem -0.8rem;
    background: rgba(30, 58, 138, 0.9);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 0 0 6px 6px;
    text-align: center;
    backdrop-filter: blur(2px);
}

.line-detail-card .card-footer .line-info {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    opacity: 0.95;
}

.line-detail-card .part-info {
    font-size: 0.65rem;
    opacity: 0.85;
    margin: 0;
    color: white;
}

.pagination-controls {
    display: none !important; /* Completely hidden */
}

.pagination-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pagination-dots {
    display: flex;
    gap: 0.5rem;
}

.pagination-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pagination-dot.active {
    background: #1e3a8a;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    color: #1e3a8a;
}

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

.btn-secondary:hover {
    background: #4b5563;
}

.btn-secondary:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.hq-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 1.5rem;
    text-align: center;
}

.overall-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    text-align: center;
}

.overall-stat {
    border-right: 1px solid #e5e7eb;
}

.overall-stat:last-child {
    border-right: none;
}

.overall-stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.overall-stat-label {
    font-size: 1rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.division-section {
    margin-bottom: 2rem;
}

.division-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.last-update {
    text-align: right;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .buildings-grid, .lines-grid {
        grid-template-columns: 1fr;
    }

    .building-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .overall-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.btn {
    background: #e8f0fe;
    color: #1e3a8a;
    border: 1px solid #1e3a8a;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #1e3a8a;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    text-decoration: none;
}

/* Building Detail Page Styles */
.building-summary {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.summary-stat {
    text-align: center;
    border-right: 1px solid #e5e7eb;
}

.summary-stat:last-child {
    border-right: none;
}

.summary-stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #1e3a8a;
    margin-bottom: 0.5rem;
}

.summary-stat-label {
    font-size: 0.9rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.production-lines {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.lines-header {
    margin-bottom: 2rem;
}

.lines-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 1rem;
}

.line-large-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.line-large-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.line-status-header {
    padding: 1rem 1.5rem;
    color: white;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.line-timer {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 1rem;
}

.line-content {
    padding: 1.5rem;
}

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

.production-stat {
    text-align: center;
}

.production-stat-label {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.production-stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.production-stat-value.target {
    color: #64748b;
}

.production-stat-value.actual {
    color: #1e3a8a;
}

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

.metric-horizontal {
    text-align: center;
}

.metric-horizontal-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.metric-horizontal-value {
    font-size: 1.3rem;
    font-weight: bold;
}

.line-timeline-bar {
    height: 50px;
    background: #f3f4f6;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.line-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

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

.line-timestamp {
    font-family: 'Monaco', 'Menlo', monospace;
}

/* Management Page Styles */
.management-header {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

.management-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 1rem;
    text-align: center;
}

.management-description {
    text-align: center;
    color: #6b7280;
    font-size: 1.1rem;
}

.section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

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

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e3a8a;
}

.add-button {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.add-button:hover {
    background: #059669;
}

.items-list {
    display: grid;
    gap: 0.5rem;
}

.item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.item:hover {
    background: #f1f5f9;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.item-meta {
    font-size: 0.85rem;
    color: #6b7280;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.edit-button {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.edit-button:hover {
    background: #2563eb;
}

.delete-button {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.delete-button:hover {
    background: #dc2626;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

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

.modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e3a8a;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
}

/* HQ Panel Fixed Layout - No Scroll */
.container {
    height: calc(100vh - 140px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    width: 100vw;
}

/* Management Page Styles */
.management-container {
    padding: 1rem;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

.management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
    max-width: 1600px;
    margin: 0 auto;
}

.target-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.target-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.target-label {
    font-weight: 500;
    color: #4b5563;
}

.target-value {
    font-weight: 600;
    color: #1f2937;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Building Details View Styles */
.buildings-view {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.buildings-selection {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    height: 100vh;
}

.buildings-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    height: calc(100vh - 180px);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* Building Card Slide Animation - Smooth Fade Transitions */
.building-slide {
    width: 100%;
    height: 100%;
    position: relative;
    opacity: 1;
    transform: translateX(0);
    /* Transitions are handled programmatically to avoid flickering */
    will-change: opacity, transform;
}

/* Ensure smooth transitions without conflicts */
.building-slide * {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Hardware acceleration for canvas elements */
.building-slide canvas {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.building-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.building-summary-card {
    background: #1e3a8a;
    color: white;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.building-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 1rem;
}

.building-summary-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.building-summary-status {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
}

.building-summary-content {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    height: 100%;
    min-height: 0;
}

.building-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.75rem;
    text-align: center;
    flex: 1;
    align-content: start;
    min-width: 0;
    overflow: hidden;
}

.building-pie-chart-container {
    width: 100px;
    height: 100px;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.building-summary-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    overflow: hidden;
}

.building-summary-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.building-summary-stat-label {
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lines-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.building-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.lines-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    height: calc(100vh - 220px);
    overflow: hidden;
}

/* Building Detail Page Styles */
.building-detail-page {
    height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0.5rem 0;
    width: 100%;
}

.building-detail-header {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    padding: 0 1rem;
}

.building-detail-title h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1e3a8a;
    margin: 0;
}


.line-cards-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 1rem;
}

.line-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    height: calc(100vh - 140px);
    align-items: stretch;
    padding: 0 0.5rem;
    overflow: hidden;
    align-content: stretch;
}

.line-detail-card {
    background: #1e3a8a;
    color: white;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255,255,255,0.1);
}

.line-detail-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}


/* Professional Line Card Styles */
.line-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.line-status-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.line-status-badge.running {
    background: #4CAF50;
    color: white;
}

.line-status-badge.idle {
    background: #FF9800;
    color: white;
}

.line-status-badge.maintenance {
    background: #2196F3;
    color: white;
}

.line-status-badge.breakdown,
.line-status-badge.down {
    background: #F44336;
    color: white;
}

.line-status-badge.setup {
    background: #FFEB3B;
    color: #333;
}

.line-uptime {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
}

.line-main-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 0.75rem;
    text-align: center;
    align-items: center;
    flex: 1;
    min-height: 80px;
}

.line-production-stats {
    flex: 1;
}

.production-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.1rem;
    line-height: 0.9;
}

.production-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.line-metrics {
    display: flex;
    justify-content: space-around;
    margin-bottom: 0.25rem;
    text-align: center;
}

.metric-item {
    flex: 1;
}

.metric-value {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.metric-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.line-timeline-container {
    margin: 0.25rem 0;
    padding: 0 0.25rem;
}

.line-timeline {
    height: 40px;
    background: rgba(0,0,0,0.4);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.5);
    width: 100%;
    min-height: 40px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.2);
    margin: 0.5rem 0 0.25rem 0;
}

/* Timeline segments styling */
.line-timeline > div {
    position: absolute;
    height: 100%;
    top: 0;
}

/* Detailed timeline bar (full-width status bar) */
.detailed-timeline-bar {
    width: 100%;
    height: 32px;
    background: transparent;
    border-radius: 0px;
    position: relative;
    overflow: hidden;
    margin: 0.5rem 0 0 0;
    padding: 0;
    border: none;
    box-shadow: none;
    min-height: 32px;
    display: block !important;
    visibility: visible !important;
}

.line-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.part-info {
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    font-size: 0.95rem;
}

.line-name {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Management Page Styles */
.management-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.nav-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.management-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
}

.management-menu {
    display: flex;
    gap: 0.3rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.nav-menu-item {
    padding: 0.35rem 0.5rem;
    background: transparent;
    color: #64748b;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.nav-menu-item:hover {
    background: #e2e8f0;
    color: #1e3a8a;
}

.nav-menu-item.active {
    background: #1e3a8a;
    color: white;
    font-weight: 600;
}

.management-container {
    padding: 2rem;
    height: calc(100vh - 90px);
    overflow-y: auto;
}

.management-section {
    display: none;
}

.management-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e40af;
    margin: 0;
}

.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.management-item-card, .item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.management-item-card:hover, .item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.item-info {
    flex: 1;
}

.item-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.item-detail, .item-meta {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    font-size: 1.1rem;
}

.line-targets-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.line-target-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.line-target-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.line-target-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.line-target-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
}

.line-target-actions {
    display: flex;
    gap: 0.5rem;
}

.line-target-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.target-info-item {
    text-align: center;
}

.target-info-label {
    font-size: 0.8rem;
    color: #6b7280;
    display: block;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.target-info-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e40af;
    display: block;
}

.target-notes {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
    font-size: 0.9rem;
    color: #6b7280;
    font-style: italic;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    margin: auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 1.5rem;
}

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

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}
    max-width: 1400px;
    margin: 0 auto;
}

.management-section {
    display: none;
}

.management-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    min-height: 200px;
}

.item-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: #3b82f6;
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.item-details {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.4;
}

.target-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.target-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.target-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.target-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f2937;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1.5rem 0;
}

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

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.pagination-controls {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid #e5e7eb;
}

.pagination-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pagination-dots {
    display: flex;
    gap: 0.5rem;
}

.pagination-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pagination-dot.active {
    background: #3b82f6;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-info {
    font-weight: 500;
    color: #4b5563;
}

#hq-tab {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.main-slider-container {
    height: 100%;
    position: relative;
    overflow: hidden;
    background: white;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    width: 100vw;
}

.main-slider {
    height: calc(100% - 30px);
    position: relative;
    overflow: hidden;
}

.main-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0.5s;
    padding: 0.5rem 0;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.main-slide.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0s;
    z-index: 2;
}

.main-slider-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: #1e3a8a;
    border-radius: 0 0 8px 8px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 0.5rem;
    text-align: center;
    border-bottom: 2px solid #e5e7eb;
    padding: 0 0.5rem 0.3rem 0.5rem;
    flex-shrink: 0;
}

.divisions-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 1rem 0;
    min-height: 0;
    height: calc(100% - 25px);
}

.division-card {
    background: #f8f9fa;
    border-radius: 0;
    padding: 0.25rem 0.25rem 0.75rem 0.25rem;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    border-left: none;
    border-right: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.division-card .division-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 0.25rem;
    text-align: center;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.15rem;
}

.division-card .buildings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.5rem;
    flex: 1;
    overflow: visible;
    align-content: start;
    height: auto;
    min-height: 0;
    padding: 0.2rem 0.2rem 0.5rem 0.2rem;
}

.building-card-small {
    background: #1e3a8a;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    border: 1px solid #1e3a8a;
    overflow: visible;
    transition: transform 0.2s ease;
    height: auto;
    display: flex;
    flex-direction: column;
    margin: 0.1rem;
}

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

.building-header-small {
    background: transparent;
    color: white;
    padding: 0.5rem 0.6rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.building-title-small {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.building-stats-small {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    font-size: 0.7rem;
    margin-bottom: 0.4rem;
}

.building-stats-small:last-of-type {
    margin-bottom: 0;
    margin-top: auto;
}

.building-stats-secondary {
    opacity: 0.9;
}

.stat-small {
    text-align: center;
}

.building-timeline-container {
    position: relative;
    height: 18px;
    background: #f3f4f6;
    border-radius: 0;
    margin: 0;
    overflow: hidden;
    border: none;
    width: 100%;
    flex-shrink: 0;
}

.timeline-segment {
    position: absolute;
    top: 0;
    height: 100%;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    transition: opacity 0.2s ease;
    border-radius: 0;
}

.timeline-segment:hover {
    opacity: 0.8;
    cursor: pointer;
}

.current-time-indicator {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #dc2626;
    z-index: 10;
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.5);
}

.building-status-text-small {
    font-size: 0.7rem;
    color: #e5e7eb;
    margin-bottom: 0.1rem;
    text-align: center;
    flex-shrink: 0;
}

.hq-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1e3a8a;
    margin: 0 0 1rem 0;
    text-align: center;
    flex-shrink: 0;
}

.overall-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
    height: 80px;
    padding: 0 0.5rem;
}

.overall-stats .stat {
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.5rem;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.overall-stats .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a8a;
    display: block;
}

.overall-stats .stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 500;
}

.hq-charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    flex: 1;
    min-height: 250px;
    padding: 0 0.5rem;
}

.hq-chart-card {
    background: #f8fafc;
    border-radius: 0;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-left: none;
    border-right: none;
    display: flex;
    flex-direction: column;
}

.chart-card-header {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.chart-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.chart-summary {
    display: flex;
    gap: 1rem;
}

.summary-item {
    text-align: center;
    flex: 1;
}

.summary-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e3a8a;
    display: block;
}

.summary-label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
}

.hq-chart-card #hq-production-chart,
.hq-chart-card #hq-efficiency-chart,
.hq-chart-card #hq-status-chart {
    flex: 1;
    width: 100%;
    min-height: 180px;
    height: auto;
}

/* Division Slider */
.divisions-slider-container {
    flex: 1;
    margin: 0 0.5rem 0.5rem 0.5rem;
    position: relative;
    overflow: hidden;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-height: 300px;
}

.divisions-slider {
    height: 100%;
    position: relative;
    overflow: hidden;
}

.division-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.6s ease-in-out;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.division-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.division-slide .division-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
    flex-shrink: 0;
}

.slider-progress {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slider-progress #division-counter {
    margin-right: 10px;
}

.slider-progress #division-timer {
    color: #fbbf24;
    font-weight: 700;
}

/* Division slider buildings grid */
.division-slide .buildings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 3rem;
}

/* ===== BUILDING DETAIL PAGE STYLES ===== */

/* Building Detail Container - Optimized for maximum space usage */
.building-detail-page {
    padding: 0.5rem 1.5rem 0 1.5rem;
    min-height: calc(100vh - 80px);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Building Header - No bottom spacing */
.building-detail-header {
    margin-bottom: 0;
}

.building-detail-title h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0;
}

/* Line Cards Container - No bottom spacing to prevent card cutoff */
.line-cards-container {
    margin: 0;
    padding: 0;
    overflow: visible;
}

/* Line Cards Grid - Optimized spacing */
.line-cards-grid {
    display: grid;
    gap: 0.6rem;
    align-items: stretch;
    transition: opacity 0.3s ease;
}

/* Line Detail Cards */
.line-detail-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
    contain: layout style paint;
    transform: translateZ(0);
    will-change: height;
    overflow: visible;
}

.line-detail-card.loaded {
    opacity: 1;
}

/* Card Header */
.line-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.line-status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.line-status-badge.running {
    background-color: #10b981;
    color: white;
}

.line-status-badge.setup {
    background-color: #f59e0b;
    color: white;
}

.line-status-badge.maintenance {
    background-color: #3b82f6;
    color: white;
}

.line-status-badge.breakdown,
.line-status-badge.down {
    background-color: #ef4444;
    color: white;
}

.line-uptime {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Courier New', monospace;
}

/* Production Stats - Ultra-Compact Layout with vertical centering */
.line-main-stats {
    display: flex;
    justify-content: space-around;
    gap: 0.2rem;
    align-items: stretch;
    min-height: auto;
}

.line-production-stats {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.production-value {
    font-weight: 700;
    color: white;
}

.production-label {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* Metrics */
.line-metrics {
    display: flex;
    justify-content: space-between;
    gap: 0.3rem;
}

.metric-item {
    text-align: center;
    flex: 1;
}

.metric-value {
    font-weight: 700;
}

.metric-label {
    color: white;
    font-weight: 500;
    margin-top: 0.1rem;
}

/* Timeline Bar - Full Width Sharp Style */
.detailed-timeline-bar {
    position: relative;
    background: #e5e7eb;
    flex-shrink: 0;
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
}

/* Line Footer - Fixed Visibility */
.line-detail-card .line-footer {
    margin-top: auto;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border-radius: 0 0 6px 6px;
    backdrop-filter: blur(2px);
    font-weight: 500;
    flex-shrink: 0;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 10;
}

.line-detail-card .line-footer .line-name {
    color: white;
    display: block;
    text-align: left;
    flex: 1;
}

.line-detail-card .line-footer .part-info {
    color: white;
    display: block;
    text-align: right;
    flex: 1;
}

/* Pagination Controls - Hidden */
.pagination-controls {
    display: none !important;
    visibility: hidden !important;
}

/* Skeleton Loading Cards */
.skeleton-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    position: relative;
    overflow: hidden;
}

.skeleton-line {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    flex-shrink: 0;
}

.skeleton-line.header {
    height: 24px;
    width: 70%;
}

.skeleton-line.metrics {
    height: 18px;
    width: 50%;
}

.skeleton-line.timeline {
    height: 28px;
    width: 100%;
    margin: 0.5rem 0;
}

.skeleton-line.text {
    height: 14px;
    width: 40%;
}

.skeleton-line.text.short {
    width: 30%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.line-cards-grid.loading {
    opacity: 0.8;
}