:root {
    --bg: #0b1220;
    --fg: #fff;
    --muted: #94a3b8;
    --line: #1e2535;
    --accent: #38bdf8;

    --day-w: 26px;
    --scale-h: 44px;

    --row-pad-top: 8px;
    --row-pad-bot: 8px;
    --bar-h: 22px;
    --bar-gap: 6px;

    --label-w: 260px;
    --label-bg: #111827;
    --label-border: #1f2937;

    --track-bg: #0f172a;
    --grid-line: rgba(255, 255, 255, 0.05);

    --today-line: #ef4444;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: var(--fg);
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--fg);
    padding: 16px;
}

/* HEADER */

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    background: #1e2535;
    border: 1px solid #2c344a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.top h1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--fg);
    min-width: max-content;
}

.controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    flex: 1;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: flex-start;
    margin-left: auto;
    font-size: 12px;
    line-height: 1.2;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0f172a;
    border: 1px solid #2c344a;
    border-radius: 4px;
    padding: 4px 6px;
}

.legend-item .swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: #fff;
}

.btn {
    background: #334155;
    color: var(--fg);
    border: 1px solid #475569;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.2;
}

.btn.small {
    font-size: 11px;
    padding: 3px 6px;
}

.btn:hover {
    background: #475569;
}

.hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
}

.view-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    border: 1px solid #2c344a;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
}

/* BOARD (GANTT) */

.board {
    display: grid;
    grid-template-columns: var(--label-w) 1fr;
    width: 100%;
    max-width: 100%;
    border: 1px solid #2c344a;
    border-radius: 8px;
    background: #111827;
    overflow: hidden;
}

/* lijevi stupac */
.labels {
    background: var(--label-bg);
    border-right: 1px solid var(--label-border);
    min-width: var(--label-w);
    max-width: var(--label-w);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;

    /* PORAVNANJE s gornjom skale desno */
    padding-top: var(--scale-h);
}

.employees-board .labels {
    padding-top: var(--scale-h);
}

.labels .rowLabel {
    border-bottom: 1px solid #1f2937;
    padding: var(--row-pad-top) 12px var(--row-pad-bot) 12px;
}

.labels .rowLabel .title {
    font-weight: 600;
    color: var(--fg);
    font-size: 13px;
}

.labels .rowLabel .meta,
.cum-label {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* desni dio - grid */
.grid-wrap {
    position: relative;
    overflow: auto;
    background: var(--track-bg);
    max-width: 100%;
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
    scroll-behavior: auto;
    cursor: grab;
}

.grid-wrap.grabbing {
    cursor: grabbing;
}

/* skala */
.scale {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #1e2535;
    border-bottom: 1px solid #2c344a;
    padding-bottom: 4px;
    min-height: var(--scale-h);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.monthMarks,
.dayMarks {
    position: relative;
    height: auto;
    min-height: 18px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--muted);
}

.monthLabel {
    position: absolute;
    top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: var(--fg);
    white-space: nowrap;
}

.dayLabel {
    position: absolute;
    top: 20px;
    font-size: 10px;
    min-width: 20px;
    color: var(--muted);
    white-space: nowrap;
}

.tick-v {
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--grid-line);
    pointer-events: none;
}

.tick-v.week {
    border-left-color: rgba(255, 255, 255, 0.18);
}

/* grid */
.grid {
    position: relative;
    min-height: 200px;
    background: var(--track-bg);
    font-size: 12px;
    line-height: 1.2;
}

.rowTrack {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: transparent;
}

/* zebra */
.zebra {
    background-image: linear-gradient(to bottom,
            transparent 0%,
            transparent calc(100% - 1px),
            rgba(255, 255, 255, 0.03) calc(100% - 1px),
            rgba(255, 255, 255, 0.03) 100%);
}

/* bar = interval grupe/vozila */
.bar {
    position: absolute;
    border-radius: 3px;
    color: #0b1220;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    padding: 3px 4px;
    border: 1px solid rgba(0, 0, 0, 0.4);
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

/* danas linija */
.todayLine {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--today-line);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
    pointer-events: none;
    z-index: 10;
}

/* cumulative row */
.cumuTrack {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.15);
}

.cumuCell {
    position: absolute;
    top: 0;
    bottom: 0;
    font-size: 11px;
    line-height: 1.2;
    color: var(--fg);
    text-align: center;
    padding-top: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* EMPLOYEES SECTION */

.employees-section {
    margin-top: 24px;
    border: 1px solid #2c344a;
    border-radius: 8px;
    background: #111827;
    overflow: hidden;
}

.employees-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px 12px;
    padding: 12px 16px;
    background: #1e2535;
    border-bottom: 1px solid #2c344a;
}

.employees-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg);
}

.employees-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.employees-board {
    display: grid;
    grid-template-columns: var(--label-w) 1fr;
    max-width: 100%;
}

/* prisutnost */
.emp-dot {
    position: absolute;
    font-size: 11px;
    line-height: 1;
    text-align: center;
    color: var(--fg);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(0, 0, 0, 0.6);
}

.emp-dot.present {
    background: rgba(56, 189, 248, 0.18);
    color: var(--accent);
    font-weight: 600;
}

/* tooltip */
.hover-tooltip {
    position: fixed;
    z-index: 100000;
    pointer-events: none;
    background: #1e2535;
    border: 1px solid #38bdf8;
    border-radius: 6px;
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.8),
        0 0 16px rgba(56, 189, 248, 0.5);
    padding: 8px 10px;
    color: var(--fg);
    max-width: 320px;
    font-size: 12px;
    line-height: 1.4;
}

.hover-tooltip .title {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
    font-size: 12px;
}

.hover-tooltip .item {
    font-size: 12px;
    color: var(--fg);
    line-height: 1.4;
    word-break: break-word;
}

/* sticky left col */
.sticky-left {
    position: sticky;
    left: 0;
    z-index: 30;
}

/* scrollbars */
.grid-wrap::-webkit-scrollbar,
body::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.grid-wrap::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: #1e2535;
}

.grid-wrap::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.grid-wrap::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}