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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #e94560;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
}

.header-left,
.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.board-select {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.board-select:focus {
    outline: none;
    border-color: var(--accent);
}

.board-name-input {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    min-width: 200px;
}

.board-name-input:hover {
    border-color: var(--bg-tertiary);
}

.board-name-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
}

.btn-warning:hover:not(:disabled) {
    background: #fbbf24;
    filter: brightness(1.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-warning:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}

.canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* SVG Users */
.user-group {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.user-group:hover {
    transform: scale(1.05);
}

.user-group.selected .user-circle {
    stroke: var(--accent);
    stroke-width: 4;
}

/* Highlighted user (when project is selected or user itself is highlighted) */
.user-group.highlighted .user-circle {
    stroke-width: 2;
}

/* User highlight border - separate element for visible border */
.user-highlight-border {
    pointer-events: none;
    filter: drop-shadow(0 0 8px currentColor);
}

/* Fade out non-highlighted users when a project is highlighted */
body:has(.project-group.highlighted) .user-group:not(.highlighted) {
    opacity: 0.3;
}

.user-bg {
    fill: var(--bg-secondary);
    stroke: var(--bg-tertiary);
    stroke-width: 2;
}

.user-progress {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
}

.user-circle {
    stroke: var(--bg-tertiary);
    stroke-width: 2;
    transition: all 0.2s ease;
}

.user-initials {
    fill: white;
    font-size: 24px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
    user-select: none;
}

.user-name {
    fill: var(--text-primary);
    font-size: 14px;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
}

.user-hours {
    fill: var(--text-secondary);
    font-size: 12px;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
}

.user-burn-hours {
    fill: var(--text-secondary);
    font-size: 10px;
    text-anchor: middle;
    font-weight: 300;
    opacity: 0.7;
    pointer-events: none;
    user-select: none;
}

/* SVG Projects */
.project-group {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.project-group:hover {
    transform: scale(1.05);
}

.project-group.selected .project-rect {
    stroke: var(--accent);
    stroke-width: 4;
}

.project-group.drop-target .project-rect {
    stroke: var(--success);
    stroke-width: 4;
    stroke-dasharray: 8 4;
    animation: dash 0.5s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -12;
    }
}

/* Highlighted project (when user is selected or project itself is highlighted) */
.project-group.highlighted .project-rect {
    stroke-width: 2;
}

/* Project highlight border - separate element for visible border */
.project-highlight-border {
    pointer-events: none;
    filter: drop-shadow(0 0 8px currentColor);
}

/* Fade out non-highlighted projects when a user is highlighted */
body:has(.user-group.highlighted) .project-group:not(.highlighted) {
    opacity: 0.3;
}

.project-bg {
    fill: var(--bg-secondary);
    stroke: var(--bg-tertiary);
    stroke-width: 2;
}

.project-progress {
    transition: width 0.3s ease;
}

.project-rect {
    stroke: var(--bg-tertiary);
    stroke-width: 2;
    transition: all 0.2s ease;
}

.project-name {
    fill: white;
    font-size: 16px;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
    user-select: none;
}

.project-hours {
    fill: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
}

.project-burn-hours {
    fill: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    text-anchor: middle;
    font-weight: 300;
    pointer-events: none;
    user-select: none;
}

/* Highlighted connection hours (shown when hovering user/project) */
.highlighted-connection-hours {
    fill: rgba(255, 255, 255, 0.95);
    font-weight: bold;
    font-size: 14px;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
    animation: fadeIn 0.2s ease-in;
}

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

/* Connections */
.connection-line {
    fill: none;
    stroke: #4a4a5e;
    stroke-width: 2;
    stroke-linecap: round;
    cursor: pointer;
    transition: stroke 0.2s ease, stroke-width 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.connection-line:hover {
    stroke: var(--accent);
    stroke-width: 4;
}

.connection-line.temp {
    stroke: var(--accent);
    stroke-dasharray: 8 4;
    opacity: 0.7;
    pointer-events: none;
}

.connection-group.selected .connection-line {
    stroke: var(--accent);
    stroke-width: 4;
}

/* Highlighted connections */
.connection-group.highlighted .connection-line {
    stroke-width: 8;
    opacity: 1;
    filter: drop-shadow(0 0 12px currentColor);
}

.connection-group:not(.highlighted) .connection-line {
    opacity: 0.3;
}

/* Reset opacity when nothing is highlighted */
body:not(:has(.connection-group.highlighted)) .connection-line {
    opacity: 1;
}

.connection-label {
    fill: #6a6a7e;
    font-size: 11px;
    font-weight: 500;
    text-anchor: middle;
    pointer-events: auto !important;
    cursor: pointer !important;
    user-select: none;
    paint-order: stroke fill;
    stroke: var(--bg-primary);
    stroke-width: 3px;
    transition: opacity 0.2s ease, font-size 0.2s ease, font-weight 0.2s ease, fill 0.2s ease;
}

/* Background for highlighted connection label */
.connection-label-background {
    fill: #1A1A2E;
    pointer-events: none;
    filter: drop-shadow(0 0 8px #1A1A2E);
}

/* Highlighted connection labels */
.connection-group.highlighted .connection-label {
    font-size: 16px;
    font-weight: 800;
    stroke: #1A1A2E;
    stroke-width: 4px;
    filter: drop-shadow(0 0 8px #1A1A2E) drop-shadow(0 0 4px #1A1A2E);
}

.connection-group:not(.highlighted) .connection-label {
    opacity: 0.3;
}

/* Reset label opacity when nothing is highlighted */
body:not(:has(.connection-group.highlighted)) .connection-label {
    opacity: 1;
}

/* Connection outline - background shadow layer (rendered under main line) */
.connection-outline {
    fill: none;
    stroke: #1A1A2E;
    stroke-width: 8;
    stroke-linecap: round;
    pointer-events: none;
}

/* Hovered connections in base layer - keep them visible but not too prominent */
.connection-group.hovered .connection-line {
    stroke: var(--accent);
    stroke-width: 5;
    opacity: 1 !important;
}

.connection-group.hovered .connection-label {
    font-size: 14px;
    font-weight: 700;
    fill: var(--accent) !important;
    opacity: 1 !important;
}

/* Top layer hovered connection - rendered above everything */
/* Multi-layer outline for better masking of nearby connections */
.connection-outline-wide {
    fill: none;
    stroke: #1A1A2E;
    stroke-width: 24;
    stroke-linecap: round;
    pointer-events: none;
    opacity: 0.95;
}

.connection-outline-medium {
    fill: none;
    stroke: #1A1A2E;
    stroke-width: 18;
    stroke-linecap: round;
    pointer-events: none;
    opacity: 0.98;
}

.connection-outline-narrow {
    fill: none;
    stroke: #1A1A2E;
    stroke-width: 12;
    stroke-linecap: round;
    pointer-events: none;
}

.connection-line-top {
    fill: none;
    stroke: var(--accent);
    stroke-width: 5;
    stroke-linecap: round;
    pointer-events: none;
}

.connection-label-top {
    fill: var(--accent);
    font-size: 14px;
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
    paint-order: stroke fill;
    stroke: var(--bg-primary);
    stroke-width: 3px;
}

/* Footer */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 6px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
    position: relative;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1;
}

.stat-ok .stat-value {
    color: var(--success);
}

.stat-warning .stat-value {
    color: var(--danger);
}

.stat-highlighted {
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 2px solid var(--bg-tertiary);
    transition: all 0.3s ease;
}

.stat-highlighted .stat-value {
    color: var(--accent);
    transition: all 0.3s ease;
}

.stat-group {
    display: flex;
    gap: 12px;
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 2px solid var(--bg-tertiary);
    position: relative;
}

.stat-group-header {
    position: absolute;
    top: -8px;
    left: 8px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 1px 6px;
    border-radius: 3px;
    z-index: 1;
}

.stat-group-users {
    border-color: rgba(14, 165, 233, 0.4);
}

.stat-group-users .stat-group-header {
    color: rgba(14, 165, 233, 0.9);
}

.stat-group-projects {
    border-color: rgba(251, 191, 36, 0.4);
}

.stat-group-projects .stat-group-header {
    color: rgba(251, 191, 36, 0.9);
}

.stat-group-balance {
    border-color: rgba(148, 163, 184, 0.4);
    padding-top: 6px;
}

.stat-group-balance .stat-group-header {
    color: rgba(148, 163, 184, 0.9);
}

.balance-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 40px;
}

.balance-bar {
    width: 4px;
    height: 32px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.balance-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    transition: height 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.balance-fill.balance-positive {
    background: linear-gradient(to top, var(--success), rgba(74, 222, 128, 0.6));
}

.balance-fill.balance-negative {
    background: linear-gradient(to top, var(--danger), rgba(239, 68, 68, 0.6));
}

.balance-arrow {
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
}

.balance-arrow-up {
    color: var(--success);
}

.balance-arrow-down {
    color: var(--danger);
}

.balance-arrow-equal {
    color: var(--text-secondary);
}

/* Balance Gauge */
.balance-gauge {
    width: 60px;
    height: 45px;
}

.gauge-arc {
    stroke: rgba(148, 163, 184, 0.3);
    stroke-width: 2;
    stroke-linecap: round;
}

.gauge-tick {
    stroke: rgba(148, 163, 184, 0.4);
    stroke-width: 1.5;
}

.gauge-center {
    fill: rgba(148, 163, 184, 0.6);
}

.gauge-needle {
    stroke: rgba(251, 191, 36, 0.9);
    stroke-width: 2;
    stroke-linecap: round;
    transition: transform 0.3s ease;
}

.gauge-needle-tip {
    fill: rgba(251, 191, 36, 0.9);
    transition: transform 0.3s ease;
}

.stat-balance .balance-value {
    font-size: 22px;
    font-weight: 800;
}

.stat-group .stat {
    position: relative;
}

.stat-group .stat:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 60%;
    background: var(--bg-secondary);
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 150px;
}

.context-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
}

.context-menu button:hover {
    background: var(--bg-tertiary);
}

.context-menu button.danger {
    color: var(--danger);
}

.context-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    min-width: 320px;
    max-width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

.modal label {
    display: block;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal input[type="text"],
.modal select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.modal input[type="number"] {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.modal select {
    cursor: pointer;
}

.modal input:focus,
.modal select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Style dla strzałek input[type="number"] */
.modal input[type="number"]::-webkit-inner-spin-button,
.modal input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    cursor: pointer;
    filter: invert(1) brightness(1.5);
    transform: scale(1.5);
    margin-left: 8px;
}

.modal input[type="color"] {
    display: block;
    margin-top: 6px;
    width: 60px;
    height: 36px;
    padding: 2px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    cursor: pointer;
}

.modal p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions > :first-child:not(:only-child) {
    margin-right: auto;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Range Input (Slider) */
.modal input[type="range"] {
    display: block;
    width: 100%;
    margin-top: 12px;
    margin-bottom: 12px;
    height: 18px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--bg-tertiary) 0%, var(--bg-tertiary) 100%);
    background-size: 100% 6px;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
}

/* Track - WebKit (Chrome, Safari, Edge) */
.modal input[type="range"]::-webkit-slider-track {
    width: 100%;
    height: 6px;
    background: transparent;
    border: none;
}

/* Track - Firefox */
.modal input[type="range"]::-moz-range-track {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    border: none;
}

/* Thumb - WebKit */
.modal input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: -6px;
}

.modal input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(233, 69, 96, 0.5);
}

/* Thumb - Firefox */
.modal input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.modal input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(233, 69, 96, 0.5);
}

/* Out of range styling - hide thumb and reduce opacity */
.modal input[type="range"].out-of-range {
    opacity: 0.3;
}

.modal input[type="range"].out-of-range::-webkit-slider-thumb {
    opacity: 0;
    pointer-events: none;
}

.modal input[type="range"].out-of-range::-moz-range-thumb {
    opacity: 0;
    pointer-events: none;
}

/* Sort Handle */
.sort-handle-group {
    cursor: move;
    transition: opacity 0.2s ease;
    pointer-events: all;
}

.user-group:hover .sort-handle-group,
.user-group.hovered .sort-handle-group,
.project-group:hover .sort-handle-group,
.project-group.hovered .sort-handle-group,
.user-group.sort-dragging .sort-handle-group,
.project-group.sort-dragging .sort-handle-group {
    opacity: 1 !important;
}

.sort-handle-bg {
    fill: var(--accent);
    stroke: white;
    stroke-width: 2;
    transition: all 0.2s ease;
    filter: drop-shadow(0 0 4px rgba(233, 69, 96, 0.8));
}

.sort-handle-group:hover .sort-handle-bg {
    fill: #ff3366;
    stroke: white;
    filter: drop-shadow(0 0 10px rgba(255, 51, 102, 1));
}

.sort-handle-line {
    stroke: white;
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
    transition: all 0.2s ease;
}

.sort-handle-group:hover .sort-handle-line {
    stroke: white;
}

/* Checkbox styling for modal */
.modal .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-top: 8px;
}

.modal .checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.modal .checkbox-label .checkbox-text {
    color: var(--text-primary);
    font-size: 14px;
}

/* Login Modal */
.login-overlay {
    background: var(--bg-primary);
}

.login-modal {
    min-width: 340px;
    text-align: center;
}

.login-modal h3 {
    margin-bottom: 24px;
}

.login-form {
    margin-bottom: 24px;
}

.login-form label {
    display: block;
    text-align: left;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 16px;
    margin-top: 8px;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

.login-form label + label {
    margin-top: 16px;
}

.login-error {
    color: var(--danger);
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
}

/* Coordinator star styling */
.connection-label.coordinator {
    font-weight: 700;
}

/* Coordinator badges on projects */
.coordinator-badges {
    pointer-events: none;
}

.coordinator-badge {
    transition: transform 0.2s ease;
}

.coordinator-circle {
    stroke: var(--bg-primary);
    stroke-width: 2;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.coordinator-initials {
    fill: white;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    user-select: none;
}

/* Sync Status Indicator */
.stat-sync {
    min-width: 60px;
}

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

.sync-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.sync-dot.connected {
    background-color: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
    animation: pulse-green 2s infinite;
}

.sync-dot.disconnected {
    background-color: #f87171;
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.6);
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
    }
    50% {
        box-shadow: 0 0 16px rgba(74, 222, 128, 0.9);
    }
}

.stat-connected .stat-label {
    color: #4ade80;
}

.stat-disconnected .stat-label {
    color: #f87171;
}

/* Save Status Indicator */
.stat-save {
    min-width: 90px;
    position: absolute;
    right: 60px; /* positioned to the left of the menu button */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* ignore mouse events when hidden */
}

.stat-save.stat-visible {
    opacity: 1;
    pointer-events: auto;
}

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

/* Save Spinner - minimalistic rotating spinner */
.save-spinner {
    width: 10px;
    height: 10px;
    border: 2px solid var(--bg-tertiary);
    border-top-color: #f59e0b;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

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

/* Save Checkmark - green check */
.save-checkmark {
    color: #4ade80;
    animation: checkmark-appear 0.3s ease;
}

@keyframes checkmark-appear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Save Error Icon - red exclamation mark */
.save-error-icon {
    width: 14px;
    height: 14px;
    background-color: #f87171;
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    animation: error-shake 0.4s ease;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Stat Label Colors */
.stat-save.stat-saving .stat-label {
    color: #f59e0b;
}

.stat-save.stat-saved .stat-label {
    color: #4ade80;
}

.stat-save.stat-error .stat-label {
    color: #f87171;
}

/* Remote Update Notification */
.sync-notification {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: slide-down 0.3s ease;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.sync-notification span {
    color: var(--text-primary);
    font-size: 14px;
}

.sync-notification .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Footer Menu */
.footer-menu-container {
    position: absolute;
    right: 16px;
}

.footer-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.footer-menu-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.footer-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 180px;
}

.footer-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    text-align: left;
    transition: background 0.15s ease;
}

.footer-dropdown button:hover {
    background: var(--bg-tertiary);
}

.footer-dropdown button svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

/* History Modal */
.history-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 16px 0;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 8px;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-date {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.history-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-actions {
    display: flex;
    gap: 8px;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.history-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.history-empty p {
    margin: 0;
    font-size: 14px;
}

/* Emoji Icons Filter - converts emoji to near-white monochrome */
.e-icon {
    display: inline-block;
    filter: grayscale(75%) brightness(1.5) contrast(0.8);
    opacity: 0.9;
}

/* ===== Assignments Modal Styles ===== */

/* Assignments Modal Container */
.assignments-modal {
    min-width: 800px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Modal Header with Close Button (NEW PATTERN) */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    margin: 0;
}

.modal-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* View Toggle */
.assignments-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-btn.active {
    background: var(--accent);
    color: white;
}

/* Content Area */
.assignments-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Table Wrapper with Scroll */
.assignments-table-wrapper {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Table Base Styles */
.assignments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.assignments-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-tertiary);
}

.assignments-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--bg-secondary);
}

.assignments-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.assignments-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Sticky First Column */
.sticky-col {
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--bg-secondary);
    font-weight: 500;
}

.assignments-table thead .sticky-col {
    z-index: 15;
    background: var(--bg-tertiary);
}

/* Color Indicators */
.user-indicator,
.project-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Hours Cells */
.hours-cell {
    text-align: center;
    font-family: 'Courier New', monospace;
}

.empty-cell {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Total Column */
.total-col {
    text-align: center;
    font-weight: 600;
    background: var(--bg-tertiary);
}

/* Status Colors (matching PDF generator) */
.status-ok {
    background-color: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.status-near {
    background-color: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

.status-over {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.status-empty {
    background-color: transparent;
    color: var(--text-secondary);
}

/* Summary Section */
.assignments-summary {
    display: flex;
    gap: 24px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 16px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Legend */
.assignments-legend {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--bg-tertiary);
}

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

.legend-indicator {
    width: 20px;
    height: 12px;
    border-radius: 3px;
}

/* ===== User Modal - Projects Section ===== */

.modal-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--bg-tertiary);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding: 2px;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    transition: background 0.2s ease;
}

.project-item:hover {
    background: rgba(233, 69, 96, 0.1);
}

.project-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.project-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-name {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.hours-input {
    width: unset !important;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-secondary);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    text-align: center;
}

.hours-input:focus {
    outline: none;
    border-color: var(--accent);
}

.hours-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.coordinator-star {
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    opacity: 0.3;
    transition: all 0.2s ease;
    padding: 4px;
    line-height: 1;
}

.coordinator-star:hover {
    opacity: 0.6;
    transform: scale(1.2);
}

.coordinator-star.active {
    color: var(--warning);
    opacity: 1;
}

.coordinator-star.active:hover {
    transform: scale(1.3);
}

.btn-delete-connection {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--bg-secondary);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-delete-connection:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.empty-projects {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.empty-projects p {
    margin: 0;
}

/* ===== EASTER EGG STYLES ===== */


.easter-egg-modal {
    display: none;
    width: 90%;
    max-width: 1000px;
    padding: 0;

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

.easter-egg-modal .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.easter-egg-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

.easter-egg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}
/* ===== END EASTER EGG STYLES ===== */

/* ===== NOTES FEATURE ===== */

/* Notes icon */
.notes-icon-group {
    cursor: pointer;
    transition: opacity 0.2s ease;
    pointer-events: all;
}

.user-group:hover .notes-icon-group,
.user-group.hovered .notes-icon-group,
.project-group:hover .notes-icon-group,
.project-group.hovered .notes-icon-group {
    opacity: 1 !important;
}

.notes-icon-emoji {
    cursor: pointer;
    transition: all 0.2s ease;
    filter: grayscale(100%) brightness(0.6); /* Gray when empty */
    pointer-events: none;
}

.notes-icon-emoji.has-content {
    filter: grayscale(0%) brightness(1); /* Full color when has content */
}

.notes-icon-group:hover .notes-icon-emoji {
    filter: grayscale(0%) brightness(1.2); /* Brighter on hover */
}

/* Floating notes windows */
.notes-windows-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1002;
}

.notes-window {
    position: absolute;
    width: 400px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    pointer-events: all;
    display: flex;
    flex-direction: column;
}

.notes-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--accent);
    border-radius: 6px 6px 0 0;
    cursor: move;
    user-select: none;
}

.notes-window-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.notes-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.notes-close-btn:hover {
    color: var(--accent);
}

.notes-window-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    max-height: 500px;
}

.notes-preview {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--bg-tertiary);
    overflow-y: auto;
    max-height: 200px;
    min-height: 40px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.notes-preview:empty::before {
    content: 'Brak treści notatki...';
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.6;
}

.notes-preview h1, .notes-preview h2, .notes-preview h3 {
    margin: 0.5em 0;
    color: var(--accent);
}
.notes-preview h1 { font-size: 1.4em; }
.notes-preview h2 { font-size: 1.2em; }
.notes-preview h3 { font-size: 1.1em; }

.notes-preview p { margin: 0.5em 0; }
.notes-preview ul, .notes-preview ol { margin: 0.5em 0; padding-left: 1.5em; }
.notes-preview a { color: var(--accent); text-decoration: underline; }
.notes-preview strong { font-weight: 700; }
.notes-preview blockquote {
    margin: 0.5em 0;
    padding-left: 1em;
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
    font-style: italic;
}

.notes-textarea {
    width: 100%;
    min-height: 120px;
    max-height: 200px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Modal edit textarea */
.notes-edit-textarea {
    width: 100%;
    min-height: 250px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.notes-edit-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.markdown-hint {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 4px;
}

/* Notes window footer */
.notes-window-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--bg-tertiary);
}

.btn-small {
    font-size: 13px;
    padding: 8px 16px;
}

/* Notes preview in modal */
.notes-preview-small {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--bg-tertiary);
    max-height: 150px;
    overflow-y: auto;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    margin-top: 8px;
}

.notes-preview-small:empty::before {
    content: 'Brak notatki';
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.6;
}

.notes-preview-small h1,
.notes-preview-small h2,
.notes-preview-small h3 {
    margin: 0.5em 0;
    color: var(--accent);
}
.notes-preview-small h1 { font-size: 1.2em; }
.notes-preview-small h2 { font-size: 1.1em; }
.notes-preview-small h3 { font-size: 1em; }

.notes-preview-small p { margin: 0.5em 0; }
.notes-preview-small ul, .notes-preview-small ol { margin: 0.5em 0; padding-left: 1.5em; }
.notes-preview-small a { color: var(--accent); text-decoration: underline; }
.notes-preview-small strong { font-weight: 700; }
.notes-preview-small blockquote {
    margin: 0.5em 0;
    padding-left: 1em;
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
    font-style: italic;
}

.btn-edit-note {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 8px;
    font-size: 16px;
    transition: color 0.2s ease;
}

.btn-edit-note:hover {
    color: var(--accent);
}

.modal-notes-section {
    margin-top: 20px;
}

.modal-notes-section .section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* ===== END NOTES FEATURE ===== */
