/* ============================================================
   Raspored — design system
   ============================================================ */

:root {
    --bg: #f2f4fa;
    --surface: #ffffff;
    --border: #e4e7f2;
    --border-strong: #cfd4e6;
    --text: #171c2e;
    --muted: #64708a;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-border: #c7d2fe;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;
    --success: #15803d;
    --success-light: #f0fdf4;
    --success-border: #bbf7d0;
    --warning: #b45309;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;
    --info: #0369a1;
    --info-light: #f0f9ff;
    --info-border: #bae6fd;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(23, 28, 46, .05), 0 4px 16px rgba(23, 28, 46, .06);
    --shadow-lg: 0 8px 40px rgba(23, 28, 46, .16);
    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 .75rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; align-items: center; gap: .6rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- Topbar ---------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 1.4rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}
.brand:hover { text-decoration: none; }

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(79, 70, 229, .35);
}

.topbar-links { display: flex; gap: .25rem; }

.topbar-links a {
    color: var(--muted);
    font-weight: 500;
    padding: .42rem .8rem;
    border-radius: var(--radius-sm);
}
.topbar-links a:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.topbar-links a.active { color: var(--primary); background: var(--primary-light); }
.topbar-links a.topbar-org {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }

.user-chip {
    display: flex;
    align-items: center;
    gap: .55rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .25rem .7rem .25rem .3rem;
    cursor: pointer;
    font: inherit;
    color: var(--text);
}
.user-chip:hover { background: var(--bg); }

/* ---------- Avatar ---------- */

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
}
.avatar.lg { width: 42px; height: 42px; font-size: .95rem; }
.avatar.sm { width: 24px; height: 24px; font-size: .6rem; }

/* ---------- Layout ---------- */

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 26px 20px 70px;
}
.container.narrow { max-width: 760px; }
.container.wide { max-width: none; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
    flex-wrap: wrap;
}
.page-head .sub { color: var(--muted); margin-top: .15rem; }
.page-head .actions { display: flex; gap: .55rem; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
}
.card-header h2, .card-header h3 { margin: 0; }

.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

.card.clickable { transition: box-shadow .15s, transform .15s; }
.card.clickable:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
a.card-link { color: inherit; display: block; }
a.card-link:hover { text-decoration: none; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: .52rem 1.05rem;
    font: inherit;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

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

.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

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

.btn-danger-outline { background: var(--surface); border-color: var(--danger-border); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-light); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; }

.btn-google {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
    width: 100%;
}
.btn-google:hover { background: var(--bg); }

/* ---------- Forms ---------- */

.field { margin-bottom: 1rem; }

.field label {
    display: block;
    font-weight: 600;
    font-size: .88rem;
    margin-bottom: .3rem;
}

.field .hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], select, textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    background: var(--surface);
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .16);
}

input[type="color"] {
    width: 46px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}

input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; }

.field .error, .field-error {
    color: var(--danger);
    font-size: .82rem;
    margin-top: .25rem;
}

.checkbox-row { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }

.form-row { display: flex; gap: .8rem; }
.form-row > .field { flex: 1; }

.input-inline {
    width: 64px !important;
    text-align: center;
    padding: .3rem .3rem;
}

/* ---------- Tables ---------- */

.table { width: 100%; border-collapse: collapse; }

.table th {
    text-align: left;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbff; }
.table .actions-cell { text-align: right; white-space: nowrap; }
.table .actions-cell form { display: inline; }

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .14rem .6rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
    border: 1px solid transparent;
}

.badge-primary { background: var(--primary-light); color: var(--primary); border-color: var(--primary-border); }
.badge-success { background: var(--success-light); color: var(--success); border-color: var(--success-border); }
.badge-danger { background: var(--danger-light); color: var(--danger); border-color: var(--danger-border); }
.badge-warning { background: var(--warning-light); color: var(--warning); border-color: var(--warning-border); }
.badge-info { background: var(--info-light); color: var(--info); border-color: var(--info-border); }
.badge-muted { background: var(--bg); color: var(--muted); border-color: var(--border); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- Alerts ---------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    margin-bottom: 1rem;
    font-size: .92rem;
}
.alert .grow { flex: 1; }

.alert-success { background: var(--success-light); border-color: var(--success-border); color: var(--success); }
.alert-error { background: var(--danger-light); border-color: var(--danger-border); color: var(--danger); }
.alert-warning { background: var(--warning-light); border-color: var(--warning-border); color: var(--warning); }
.alert-info { background: var(--info-light); border-color: var(--info-border); color: var(--info); }

.alert-close {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: inherit;
    opacity: .6;
    padding: 0 .2rem;
}
.alert-close:hover { opacity: 1; }

/* ---------- Dropdown ---------- */

.dropdown { position: relative; }

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: .35rem;
    display: none;
    z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }

.dropdown-menu a, .dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: .45rem .7rem;
    border: none;
    background: none;
    font: inherit;
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); text-decoration: none; }
.dropdown-menu .danger { color: var(--danger); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--border); margin: .3rem 0; }

/* ---------- Modal ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 34, .55);
    z-index: 90;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px;
    overflow-y: auto;
}
.modal-backdrop.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { margin: 0; }

.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}
.modal-close:hover { color: var(--text); }

/* ---------- Empty state ---------- */

.empty {
    text-align: center;
    padding: 46px 20px;
    color: var(--muted);
}
.empty .icon { font-size: 2rem; margin-bottom: .5rem; }
.empty h3 { color: var(--text); }

/* ---------- Auth pages ---------- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(99, 102, 241, .14), transparent),
        radial-gradient(900px 400px at 95% 0%, rgba(56, 189, 248, .12), transparent),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 34px 34px 28px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1.4rem;
    color: var(--text);
}
.auth-brand .brand-mark { width: 36px; height: 36px; font-size: 1.05rem; }

.auth-card h1 { font-size: 1.25rem; text-align: center; margin-bottom: 1.2rem; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: .8rem;
    color: var(--muted);
    font-size: .8rem;
    margin: 1.1rem 0;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-foot { text-align: center; margin-top: 1.2rem; font-size: .9rem; color: var(--muted); }

/* ---------- Steps (wizard) ---------- */

.steps {
    display: flex;
    gap: .4rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .9rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
}
.step .n {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
}
.step.active { color: var(--primary); border-color: var(--primary-border); background: var(--primary-light); }
.step.active .n { background: var(--primary); color: #fff; }
.step.done { color: var(--success); border-color: var(--success-border); }
.step.done .n { background: var(--success); color: #fff; }
a.step:hover { text-decoration: none; border-color: var(--primary-border); }

/* ---------- Conflicts panel ---------- */

.conflict {
    border: 1px solid var(--danger-border);
    background: var(--danger-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: .8rem;
}
.conflict.warning { border-color: var(--warning-border); background: var(--warning-light); }

.conflict .title { font-weight: 700; color: var(--danger); display: flex; gap: .5rem; align-items: center; }
.conflict.warning .title { color: var(--warning); }
.conflict .detail { font-size: .88rem; margin: .3rem 0 .6rem; color: var(--text); }

.proposals { display: flex; flex-direction: column; gap: .45rem; }

.proposal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .5rem .5rem .8rem;
    font-size: .88rem;
}
.proposal form { margin: 0; }

/* ---------- Requirements grid (wizard step 2) ---------- */

.req-grid-wrap { overflow-x: auto; }

.req-grid { border-collapse: collapse; min-width: 100%; }
.req-grid th, .req-grid td {
    border: 1px solid var(--border);
    padding: 6px 8px;
    text-align: center;
    font-size: .85rem;
}
.req-grid th { background: #fafbff; font-weight: 600; white-space: nowrap; }
.req-grid th.weekend { background: #fff7f2; }
.req-grid td input { width: 52px; text-align: center; padding: .25rem .2rem; }
.req-grid .shift-cell { text-align: left; white-space: nowrap; font-weight: 600; }

/* ============================================================
   Kalendar
   ============================================================ */

.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.cal-legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.cal-legend .item { display: flex; align-items: center; gap: .35rem; }

.cal-scroll {
    overflow: auto;
    max-height: 72vh;
    max-width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    position: relative;
}

.cal {
    display: grid;
    /* kolone postavlja inline style: 56px + N dana */
    min-width: 900px;
}

/* Dan po članu: širina raste sa N kolona, scroll unutar .cal-scroll */
.cal.cal-by-member {
    --day-col-min: 160px;
    min-width: calc(56px + var(--day-cols, 1) * var(--day-col-min));
}

.cal-corner {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 30;
    background: var(--surface);
    border-bottom: 1px solid var(--border-strong);
    border-right: 1px solid var(--border);
}

.cal-day-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface);
    border-bottom: 1px solid var(--border-strong);
    border-right: 1px solid var(--border);
    text-align: center;
    padding: 8px 4px 6px;
}
.cal-day-head .dow { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.cal-day-head .date { font-size: 1rem; font-weight: 700; }
.cal-day-head.today { background: var(--primary-light); }
.cal-day-head.today .date { color: var(--primary); }
.cal-day-head.weekend .dow { color: #d97757; }

.cal-gutter {
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.cal-gutter .slot-label {
    height: 52px;
    font-size: .7rem;
    color: var(--muted);
    text-align: right;
    padding-right: 8px;
    transform: translateY(-8px);
}

.cal-day-col {
    position: relative;
    border-right: 1px solid var(--border);
    /* visina = 48 slotova * 26px; linije slotova preko gradijenata */
    background-image:
        repeating-linear-gradient(to bottom, transparent 0, transparent 51px, var(--border) 51px, var(--border) 52px),
        repeating-linear-gradient(to bottom, transparent 0, transparent 25px, #eef0f7 25px, #eef0f7 26px);
}
.cal-day-col.weekend { background-color: #fcfbf8; }
.cal-day-col.js-slot-create { cursor: pointer; }

.cal-slot-hover {
    position: absolute;
    left: 0;
    right: 0;
    height: 26px;
    z-index: 6;
    pointer-events: none;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    border-left: 3px solid var(--primary);
    opacity: 0;
    transform: scaleX(.985);
    transform-origin: left center;
}
.cal-slot-hover.visible {
    opacity: 1;
    transform: scaleX(1);
}
.cal-slot-hover.pulse {
    animation: cal-slot-in .16s ease;
}
@keyframes cal-slot-in {
    from { opacity: .35; transform: scaleX(.96); }
    to { opacity: 1; transform: scaleX(1); }
}
.cal-slot-hover-time {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .68rem;
    font-weight: 700;
    color: var(--primary);
}
.cal-slot-add {
    pointer-events: auto;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(79, 70, 229, .35);
}
.cal-slot-add:hover {
    background: var(--primary-hover);
    transform: translateY(-50%) scale(1.08);
}

.cal-block {
    position: absolute;
    border-radius: 7px;
    padding: 3px 6px;
    font-size: .74rem;
    line-height: 1.25;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 18, 34, .25);
    border: 1px solid rgba(255, 255, 255, .35);
    cursor: pointer;
}
.cal-block.js-block {
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.cal-block.js-block:active { cursor: grabbing; }
.cal-block:hover { filter: brightness(1.07); z-index: 5; }
.cal-block.dragging { opacity: .4; cursor: grabbing; z-index: 1; }

.cal-handle {
    position: absolute;
    left: 0;
    right: 0;
    height: 10px;
    z-index: 2;
}
.cal-handle-n { top: 0; cursor: ns-resize; }
.cal-handle-s { bottom: 0; cursor: ns-resize; }

.cal-day-col.drop-target {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background-color: var(--primary-light);
}

.cal-dnd-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 80;
    border-radius: 7px;
    padding: 3px 6px;
    font-size: .74rem;
    line-height: 1.25;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 18, 34, .35);
    border: 1px solid rgba(255, 255, 255, .45);
    opacity: .92;
}
.cal-block:has(.cal-block-text),
.cal-dnd-ghost:has(.cal-block-text) {
    padding: 6px 3px;
}
.cal-block-text {
    writing-mode: vertical-lr;
    text-orientation: mixed;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}
.cal-block-text .who {
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 100%;
}
.cal-block-text .when {
    opacity: .9;
    font-size: .68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 100%;
}

.cal-dnd-tip {
    position: fixed;
    z-index: 90;
    pointer-events: none;
    background: #111827;
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(15, 18, 34, .3);
    white-space: nowrap;
}

body.cal-dnd-active { cursor: grabbing; user-select: none; }
.cal-block .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block .when { opacity: .9; font-size: .68rem; white-space: nowrap; }
.cal-block.mine { outline: 2px solid #111827; outline-offset: 1px; }
.cal-block.dim { opacity: .22; }
.member-hidden { display: none !important; }
.cal-block.exception-block { border-style: dashed; border-color: rgba(255,255,255,.8); }

.cal-now {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #ef4444;
    z-index: 8;
    pointer-events: none;
}
.cal-now::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

/* Brojač: koliko ljudi radi u slotu */
.cal-count {
    position: absolute;
    left: 2px;
    width: 4px;
    border-radius: 2px;
    background: var(--primary);
    opacity: .25;
    pointer-events: none;
}

/* ---------- Member chips ---------- */

.member-filter-hint { margin: .35rem 0 0; }

.member-chips { display: flex; flex-wrap: wrap; gap: .5rem; }

.member-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .3rem .75rem .3rem .35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}
.member-chip:hover { border-color: var(--primary); text-decoration: none; }
.member-chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.ma-picked {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .5rem;
}
.ma-picked:empty { display: none; }
.ma-chip { cursor: default; }
.ma-chip:hover { border-color: var(--border); }
.ma-chip-remove {
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 2px;
}
.ma-chip-remove:hover { color: var(--danger); }
.ma-add-row { align-items: stretch; }
.ma-add-row select { flex: 1; width: auto; min-width: 0; }

/* ---------- Stat cards ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.stat .value { font-size: 1.45rem; font-weight: 800; }
.stat .label { font-size: .8rem; color: var(--muted); }

/* ---------- Hours summary bars ---------- */

.hours-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--bg);
    overflow: hidden;
    min-width: 110px;
}
.hours-bar .fill { height: 100%; background: var(--primary); border-radius: 4px; }
.hours-bar .fill.over { background: var(--warning); }
.hours-bar .fill.full { background: var(--success); }

/* ---------- Misc ---------- */

.public-link-box {
    display: flex;
    gap: .5rem;
    align-items: center;
    background: var(--bg);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .6rem .8rem;
    font-size: .85rem;
    word-break: break-all;
}

code.inline {
    background: var(--bg);
    padding: .1rem .4rem;
    border-radius: 5px;
    font-size: .85em;
}

.footer-note {
    text-align: center;
    color: var(--muted);
    font-size: .8rem;
    padding: 26px 0 10px;
}

@media (max-width: 720px) {
    .topbar-inner { padding: 0 12px; gap: .7rem; }
    .container { padding: 18px 12px 60px; }
    .form-row { flex-direction: column; gap: 0; }
    .auth-card { padding: 26px 20px; }
}

@media print {
    .topbar, .cal-toolbar .actions, .page-head .actions, .alert { display: none !important; }
    .cal-scroll { max-height: none; overflow: visible; }
    body { background: #fff; }
}
