:root {
    --bg-dark: #ffffff;
    --bg-panel: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --accent: #1e40af;
    --accent-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --border: #e2e8f0;
    --glass: rgba(0, 0, 0, 0.03);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #f8fafc;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Dwupoziomowy nagłówek z powiększonym logo */
.main-header,
.topbar {
    height: 104px;
    background: #ffffff;
    border-bottom: 1px solid #bfdbfe;
    display: flex;
    z-index: 10000;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 0;
    overflow: hidden;
}

.header-logo-column,
.topbar-left-logo {
    width: auto;
    min-width: 0;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-right: none;
    cursor: pointer;
    background: #ffffff;
    transition: background 0.2s;
    user-select: none;
}

.header-logo-column:hover {
    background: #ffffff;
}

.brand-logo-large {
    height: 60px;
    max-height: 62px;
    width: auto;
    max-width: none;
    object-fit: contain;
    display: block;
}

.header-content-column {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header-top-row {
    height: 54px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 16px 0 0;
    border-bottom: 1px solid #bfdbfe;
    background: #ffffff;
    box-sizing: border-box;
    position: relative;
    z-index: 5;
}

.header-sub-row {
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 16px 0 16px;
    background: #eff6ff;
    border-top: none;
    border-bottom: 1px solid #bfdbfe;
    border-left: 1px solid #bfdbfe;
    position: relative;
    margin-right: -1px;
    z-index: 15;
    box-sizing: border-box;
}

.nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    height: 100%;
}

.nav li {
    padding: 10px 22px;
    margin-bottom: 0;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-bottom: 1px solid #bfdbfe;
    user-select: none;
    position: relative;
    bottom: -1px;
    box-sizing: border-box;
    z-index: 1;
}

.nav li:first-child {
    margin-left: 0;
}

.nav li:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.nav li.active {
    background: #eff6ff;
    color: var(--accent);
    font-weight: 800;
    border: 1px solid #bfdbfe;
    border-bottom: 2px solid #eff6ff;
    position: relative;
    bottom: -1px;
    z-index: 10;
}

/* Style podmenu (menu2) - Płaski tekst bez "kartofelków", oddzielony pionowymi kreskami */
.submenu-panel {
    display: none;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.submenu-panel.active-submenu {
    display: flex;
}

.btn-menu-action,
.btn-menu-export {
    height: 36px;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    border-radius: 0;
    transition: color 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
    outline: none;
}

.submenu-panel > .btn-menu-action:first-child,
.submenu-panel > .btn-menu-export:first-child {
    padding-left: 0;
}

.btn-menu-action:hover,
.btn-menu-export:hover {
    color: var(--accent);
    background: transparent;
}

.btn-menu-action:active,
.btn-menu-export:active {
    transform: none;
    color: #1d4ed8;
}

.btn-menu-action:disabled,
.btn-menu-export:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-menu-action.btn-danger {
    color: #dc2626 !important;
    font-weight: 800 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.btn-menu-action.btn-danger:hover {
    color: #b91c1c !important;
    background: transparent !important;
    border: none !important;
}

.btn-menu-badge {
    height: 36px;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    user-select: none;
    cursor: default;
    box-shadow: none;
    border-radius: 0;
}

.btn-menu-badge strong {
    color: var(--accent);
    font-weight: 700;
}

.submenu-divider {
    width: 1px;
    height: 18px;
    background-color: #bfdbfe;
    margin: 0 2px;
    flex-shrink: 0;
    display: inline-block;
}

.btn-menu-badge strong,
.btn-menu-badge .badge-val {
    color: var(--accent);
    font-weight: 800;
}

/* Panel użytkownika (Menu klienta) jednocześnie na menu górnym i dolnym z tłem menu dolnego */
.header-user-column,
.user-panel {
    height: calc(100% - 10px);
    margin-top: 10px;
    margin-bottom: 0;
    margin-right: 16px;
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-bottom: 1px solid #bfdbfe;
    border-radius: 8px 8px 0 0; /* Promień nad menu klienta */
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    user-select: none;
    flex-shrink: 0;
    box-sizing: border-box;
    position: relative;
    bottom: 0;
    z-index: 10;
}

.header-user-column:hover,
.user-panel:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
}

.header-user-column .user-avatar,
.user-panel .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: #3b82f6;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    user-select: none;
    position: relative;
    flex-shrink: 0;
}

.header-user-column:hover .user-avatar,
.user-panel:hover .user-avatar {
    background-color: #2563eb;
}

.header-user-column .user-avatar svg,
.user-panel .user-avatar svg {
    width: 20px;
    height: 20px;
}

#topbarStatusDot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #d97706;
    border: 2px solid #eff6ff;
}

.user-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: right;
    line-height: 1.15;
}

.user-email {
    font-size: 12px;
    color: var(--text-main);
    font-weight: 700;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-client-menu-hint {
    font-size: 12px; /* Zwiększone o 2pkt z 10px */
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 1px;
    line-height: 1.1;
    letter-spacing: 0.2px;
}

.user-client-menu-hint svg {
    width: 11px;
    height: 11px;
    transition: transform 0.2s ease;
}

.header-user-column:hover .user-client-menu-hint svg,
.user-panel:hover .user-client-menu-hint svg {
    transform: translateY(1.5px);
}

.status-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 1px;
}

.connection-status {
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.2s;
    user-select: none;
    text-align: right;
}

.connection-status:hover {
    opacity: 0.8;
}

.connection-status::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: currentColor;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    padding: 32px 24px;
    overflow-y: auto;
    scroll-behavior: smooth;
    background-color: #f8fafc;
}

.view {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
}

.active-view {
    display: block;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    margin-top: 0;
    margin-bottom: 25px;
    letter-spacing: -0.02em;
}

.card {
    background: var(--bg-panel);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: white;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active { transform: scale(0.98); }

.btn-primary { 
    background: var(--accent);
    color: #ffffff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-success { 
    background: var(--success);
    color: #ffffff;
}
.btn-success:hover { background: #15803d; }

.btn-danger { 
    background: var(--danger);
    color: #ffffff;
}
.btn-danger:hover { background: #b91c1c; }

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.store-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .store-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* Kafelki STICKów */
.stick-card {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stick-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    border-color: var(--accent);
}

.stick-header {
    margin-bottom: 15px;
}

.stick-name-input {
    background: #f1f5f9;
    border: 1px solid transparent;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 18px;
    font-weight: 700;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.stick-name-input:focus {
    border-color: var(--accent);
    background: #ffffff;
}

.stick-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.stick-metrics div {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: var(--text-muted);
}

.stick-metrics span {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 4px;
}

input[type="text"], input[type="password"], select, input[type="number"] {
    padding: 10px 14px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    border-radius: 8px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

.data-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    padding: 16px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-main);
}

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

.data-table tr:hover td {
    background: #f8fafc;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Excel-like Status Board styles */
.xl-table {
    width: 100%;
    margin-top: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.xl-table th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    color: var(--text-muted);
}

.xl-table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.xl-table tr:hover td {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11px;
    text-align: center;
    letter-spacing: 0.05em;
    min-width: 90px;
}

.badge-success {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-danger {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-warning {
    background-color: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1e40af;
    font-weight: bold;
    font-size: 11px;
    width: 16px;
    height: 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 50%;
    transition: all 0.2s;
}

.tooltip:hover {
    background: #1e40af;
    color: #ffffff;
    border-color: #1e40af;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 240px;
    background-color: #0f172a;
    color: #ffffff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 10005;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    font-size: 11px;
    font-weight: normal;
    line-height: 1.4;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border: 1px solid #334155;
    pointer-events: none;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.batt-bar-container {
    width: 60px;
    height: 10px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
    margin-right: 6px;
}

.batt-bar-fill {
    height: 100%;
    transition: width 0.3s, background-color 0.3s;
}

/* Timeline component styles */
.btn-range {
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.btn-range:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.btn-range.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.timeline-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.timeline-row:last-child {
    margin-bottom: 0;
}

.btn-timeline-settings {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    box-sizing: border-box;
}

.btn-timeline-settings:hover {
    background-color: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.btn-timeline-settings img,
.btn-timeline-settings svg {
    width: 16px;
    height: 16px;
    opacity: 0.75;
    transition: all 0.2s ease;
}

.btn-timeline-settings:hover img,
.btn-timeline-settings:hover svg {
    opacity: 1;
    transform: scale(1.05);
}

.info-tooltip-container {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    box-sizing: border-box;
}

.info-tooltip-container:hover {
    background-color: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.info-tooltip-container img,
.info-tooltip-container svg {
    width: 16px;
    height: 16px;
    opacity: 0.75;
    transition: all 0.2s ease;
}

.info-tooltip-container:hover img,
.info-tooltip-container:hover svg {
    opacity: 1;
    transform: scale(1.05);
}

/* Tooltip dla ikony info */
.info-tooltip-container::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 130%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #0f172a;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: pre;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    border: 1px solid #334155;
}

.info-tooltip-container:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.timeline-machine-info {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.timeline-machine-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-machine-id {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.timeline-track-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.timeline-track {
    position: relative;
    height: 22px;
    background: #cbd5e1;
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.timeline-segment {
    position: absolute;
    top: 0;
    height: 100%;
    transition: filter 0.15s ease;
    cursor: pointer;
    min-width: 3px;
}

.timeline-segment:first-child {
    border-top-left-radius: 7px;
    border-bottom-left-radius: 7px;
}

.timeline-segment:last-child {
    border-top-right-radius: 7px;
    border-bottom-right-radius: 7px;
}

.timeline-segment.work {
    background: linear-gradient(180deg, #22c55e, #16a34a);
}

.timeline-segment.downtime {
    background: linear-gradient(180deg, #ef4444, #dc2626);
}

.timeline-segment.break,
.timeline-segment.break_planned {
    background: #cbd5e1;
}

.timeline-segment.pin-call-resolved,
.timeline-segment.pin-call-active {
    background: #dc2626;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.4);
}


.timeline-segment:hover {
    filter: brightness(1.12) saturate(1.1);
    z-index: 10;
}

/* Timeline segment tooltip */
.timeline-segment::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #0f172a;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.4;
    white-space: pre-wrap;
    width: max-content;
    max-width: 250px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    border: 1px solid #334155;
    text-align: left;
}

.timeline-segment:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.timeline-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    padding: 0 4px;
    font-weight: 600;
    user-select: none;
}

.timeline-performance-summary {
    width: 160px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border);
    padding-left: 20px;
}

.timeline-perf-value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.timeline-perf-value.good {
    color: #16a34a;
}

.timeline-perf-value.medium {
    color: #d97706;
}

.timeline-perf-value.low {
    color: #dc2626;
}

.timeline-perf-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
    margin-top: 2px;
    letter-spacing: 0.05em;
}

.timeline-perf-details {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.4;
    text-align: center;
}

/* Spinner ładowania */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}



/* Stylizacja segmentów z raportami przestojów */
.timeline-segment.has-report {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45), 0 0 4px rgba(30, 64, 175, 0.25);
    border: 1px dashed rgba(15, 23, 42, 0.4);
}

.timeline-segment.has-report::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 75%, transparent 75%, transparent);
    background-size: 8px 8px;
    pointer-events: none;
    opacity: 0.8;
}

/* Siatka analityki przestojów */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (min-width: 900px) {
    .analytics-grid {
        grid-template-columns: 1fr 1.5fr;
    }
}

.chart-card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    position: relative;
}

.stoppage-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Kolory odznak dla powodów przestojów i wezwań (STICK i PIN) */
.badge-changeover, .badge-reason-changeover, .badge-tooling, .badge-reason-tooling { background-color: #faf5ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.badge-machine_fault, .badge-reason-machine_fault, .badge-failure, .badge-reason-failure { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; font-weight: 700; }
.badge-material, .badge-reason-material { background-color: #fefce8; color: #a16207; border: 1px solid #fef08a; }
.badge-doc2d, .badge-reason-doc2d { background-color: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc; }
.badge-operator, .badge-reason-operator { background-color: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-quality, .badge-reason-quality { background-color: #fdf2f8; color: #be185d; border: 1px solid #fbcfe8; }
.badge-break_planned, .badge-reason-break_planned, .badge-break, .badge-reason-break { background-color: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-unassigned, .badge-reason-unassigned { background-color: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; }
.badge-other, .badge-reason-other, .badge-leader, .badge-reason-leader { background-color: #f8fafc; color: #475569; border: 1px solid #cbd5e1; }

/* Grupowanie wierszy osi czasu i kontenerów szczegółów */
.timeline-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 12px;
}

/* Kiedy grupa jest rozwijana, krawędzie wiersza osi czasu ulegają spłaszczeniu na dole */
.timeline-group.expanded .timeline-row {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
    box-shadow: none;
}

/* Kontener szczegółów z ładną animacją wysuwania */
.timeline-expanded-details {
    border: 1px solid var(--border);
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    background: #ffffff;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    display: none;
    animation: slideDownStoppage 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-group.expanded .timeline-expanded-details {
    display: block;
}

/* Siatka szczegółów */
.expanded-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
}

@media (min-width: 820px) {
    .expanded-details-grid {
        grid-template-columns: 1fr 1.5fr;
    }
}

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

/* ==========================================
   STYLE DRUKU / GENEROWANIA RAPORTÓW PDF
   ========================================== */
@media print {
    /* Ukrycie wszystkich innych elementów interfejsu */
    body {
        background: #ffffff !important;
        color: #000000 !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    body > * {
        display: none !important;
    }
    
    /* Wyświetlenie tylko sekcji raportu */
    #printSection {
        display: block !important;
    }
    
    #printSection {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #ffffff;
        padding: 0;
        margin: 0;
    }
    
    /* Zabezpieczenie kolorów tła */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Unikanie przełamywania maszyn w połowie strony */
    .print-machine-block {
        page-break-inside: avoid;
        break-inside: avoid;
        border-bottom: 1px solid #cbd5e1;
        padding: 20px 0;
        margin-bottom: 10px;
    }
    
    .print-timeline-track {
        height: 18px !important;
        border: 1px solid #94a3b8 !important;
    }
    
    .print-no-break {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

/* Style pomocnicze dla widoku wydruku w przeglądarce i DOM (do renderingu przed drukiem) */
#printSection {
    display: none;
    font-family: 'Outfit', 'Inter', sans-serif;
    color: #0f172a;
    background: #ffffff;
    padding: 30px;
}

.print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #1e40af;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.print-title {
    font-size: 24px;
    font-weight: 800;
    color: #1e40af;
    margin: 0;
    text-transform: uppercase;
}

.print-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 20px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 13px;
}

.print-meta-item strong {
    color: #475569;
}

.print-stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.print-stat-card {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    background: #ffffff;
}

.print-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #1e40af;
}

.print-stat-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 4px;
}

.print-machine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.print-machine-name {
    font-weight: 700;
}

.print-machine-eff {
    font-weight: 800;
    color: #16a34a;
}

.print-machine-eff.medium {
    color: #d97706;
}

.print-machine-eff.low {
    color: #dc2626;
}

.print-timeline-container {
    margin-bottom: 12px;
}

.print-reasons-bar {
    display: flex;
    height: 14px;
    border-radius: 4px;
    overflow: hidden;
    background: #e2e8f0;
    margin-bottom: 8px;
    border: 1px solid #cbd5e1;
}

.print-reasons-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 11px;
    color: #475569;
    margin-bottom: 5px;
}

.print-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.print-legend-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ==========================================
   STYLE PRZYCISKÓW EKSPORTU Z IKONAMI
   ========================================== */
.btn-icon-export {
    padding: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    box-sizing: border-box;
}

.btn-icon-export:hover {
    transform: translateY(-2px) scale(1.05);
    filter: brightness(1.03);
}

.btn-icon-export:active {
    transform: translateY(0) scale(0.97);
}

.btn-icon-export.btn-icon-csv {
    background: #e2f5ea;
    border: 1px solid #bbf7d0;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.08);
}

.btn-icon-export.btn-icon-csv:hover {
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.15);
    background: #dcfce7;
    border-color: #86efac;
}

.btn-icon-export.btn-icon-pdf {
    background: #fee2e2;
    border: 1px solid #fecaca;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.08);
}

.btn-icon-export.btn-icon-pdf:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
    background: #ffe4e4;
    border-color: #fca5a5;
}

/* Pulsujący wskaźnik stanu parowania */
.pulse-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #94a3b8; /* Slate-400 (nieaktywny) */
    display: inline-block;
    position: relative;
    transition: background-color 0.3s ease;
}

#btnTogglePairing .pulse-indicator {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.6);
}

.pulse-indicator.active {
    background-color: var(--success);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    animation: pulse 1.5s infinite;
}

#btnTogglePairing .pulse-indicator.active {
    background-color: #4ade80 !important; /* Jasnozielony przy aktywnym parowaniu */
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

/* Rozwijane menu profilu użytkownika */
.dropdown-menu {
    animation: dropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-item {
    transition: background-color 0.15s, color 0.15s;
}

.dropdown-item:hover {
    background-color: #f1f5f9 !important;
    color: var(--accent) !important;
}

#btnMenuLogout:hover {
    background-color: rgba(220, 38, 38, 0.05) !important;
    color: var(--danger) !important;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.btn-light-blue {
    background-color: #60a5fa;
    color: white;
}
.btn-light-blue:hover {
    background-color: #3b82f6;
}

/* Szuflada boczna użytkownika (Side Drawer) */
.drawer-item {
    transition: background-color 0.15s, color 0.15s;
}
.drawer-item:hover {
    background-color: #f1f5f9 !important;
    color: var(--accent) !important;
}
#btnMenuLogoutDrawer:hover {
    background-color: rgba(220, 38, 38, 0.05) !important;
    color: var(--danger) !important;
}

/* Ujednolicone kafelki stanowisk PIN (wzór Stick) */
.pin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.pin-station-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: box-shadow 0.2s, border-color 0.2s;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.pin-station-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

.pin-station-card.has-active-alert {
    border: 2px solid #dc2626;
    background: rgba(220, 38, 38, 0.02);
}

.pin-hub-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #2563eb;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Styl drukowania PDF */
@media print {
    body * {
        visibility: hidden;
    }
    #printSection, #printSection * {
        visibility: visible;
    }
    #printSection {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* Surowy, kompaktowy styl komunikatów o wykryciu STICK / PIN */
.pending-device-banner {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    color: #1e293b;
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.pending-device-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-size: 13px;
    color: #334155;
}

.pending-device-info strong {
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.pending-device-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-pending-accept {
    background: transparent;
    border: 1px solid #2563eb;
    color: #2563eb;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
    line-height: 1.4;
    outline: none;
    text-decoration: none;
    font-family: inherit;
}

.btn-pending-accept:hover {
    background: rgba(37, 99, 235, 0.08);
}

.btn-pending-cancel {
    background: transparent;
    border: 1px solid #dc2626;
    color: #dc2626;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
    line-height: 1.4;
    outline: none;
    text-decoration: none;
    font-family: inherit;
}

.btn-pending-cancel:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* Błąd baterii / odczytu poniżej 1V (bez migania) */
.battery-icon-error {
    cursor: help;
}

.badge-battery-error {
    background-color: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.35);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: help;
}

/* Komunikat wezwania Andon - w jednej linii, w czerwonej ramce, małe etykiety nad elementami */
.andon-call-banner {
    display: inline-flex;
    align-items: flex-end;
    gap: 12px;
    background: #fef2f2;
    border: 1.5px solid #dc2626;
    border-radius: 6px;
    padding: 6px 14px;
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 16px auto;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.andon-item-col {
    display: inline-flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 3px;
}

.andon-item-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    line-height: 1.1;
    white-space: nowrap;
}

.andon-item-value {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.andon-call-select {
    font-size: 13px;
    padding: 0 8px;
    height: 28px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    color: #1e293b;
    font-family: inherit;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
}

.andon-call-select:focus {
    border-color: #dc2626;
}

.andon-call-input {
    font-size: 13px;
    padding: 0 8px;
    height: 28px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    color: #1e293b;
    font-family: inherit;
    font-weight: 500;
    outline: none;
    box-sizing: border-box;
    width: 140px;
    transition: border-color 0.15s;
}

.andon-call-input:focus {
    border-color: #dc2626;
}

.btn-andon-confirm {
    background: #dc2626;
    border: 1px solid #dc2626;
    color: #ffffff;
    height: 28px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    outline: none;
    white-space: nowrap;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-andon-confirm:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-andon-dismiss {
    background: #64748b;
    border: 1px solid #64748b;
    color: #ffffff;
    height: 28px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    outline: none;
    white-space: nowrap;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-andon-dismiss:hover {
    background: #475569;
    border-color: #475569;
}

/* Ukrywanie komunikatu o blokadzie rejestracji, gdy okno logowania nie jest widoczne */
#authCard[style*="display: none"] ~ #registrationBlockedNotice,
#authCard[style*="display:none"] ~ #registrationBlockedNotice {
    display: none !important;
}
