:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --primary: #5030e5;
    --primary-soft: rgba(80, 48, 229, 0.08);
    --text: #1f1f2c;
    --muted: #5d6470;
    --border: #e3e6ef;
    --success: #2fb344;
    --warning: #f5b300;
    --danger: #f03d3d;
    --info: #0ea5e9;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    text-decoration: none;
    color: inherit;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-weight: 700;
    font-size: 1.4rem;
}

.logo span {
    color: var(--primary);
}

.tagline {
    margin: .3rem 0 0;
    color: var(--muted);
    font-size: .9rem;
}

.site-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.site-nav a {
    padding: .4rem .8rem;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 500;
}

.site-nav a:hover {
    color: var(--primary);
}

.pill-btn {
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 999px;
    padding: .4rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    background: transparent;
    font-weight: 500;
    cursor: pointer;
}

.pill-btn.danger {
    border-color: var(--danger);
    color: var(--danger);
}

.pill-btn.add-btn {
    background: var(--primary);
    color: #fff;
    border: none;
}

.small-btn {
    max-height: 40px;
    margin: auto 5px;
}

.page-shell {
    padding: 2rem 3rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 18px 55px rgba(15, 23, 61, 0.08);
}

.hero-card h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-card p {
    color: var(--muted);
    line-height: 1.7;
}

.hero-actions {
    margin: 1.5rem 0;
    display: flex;
    gap: 1rem;
}

.hero-actions .primary {
    background: var(--primary);
    color: #fff;
    padding: .8rem 1.4rem;
    border-radius: 14px;
    font-weight: 600;
}

.hero-actions .ghost {
    border: 1px dashed var(--primary);
    padding: .8rem 1.4rem;
    border-radius: 14px;
    color: var(--primary);
}

.hero-tags {
    display: flex;
    gap: .6rem;
    padding: 0;
    list-style: none;
}

.hero-tags li {
    background: var(--primary-soft);
    padding: .4rem .8rem;
    border-radius: 999px;
    font-size: .85rem;
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.stats-grid article {
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 16px;
    background: #fff;
}

.stats-grid span {
    color: var(--muted);
    font-size: .85rem;
}

.stats-grid h3 {
    margin: .5rem 0 0;
    font-size: 2rem;
}

.section-card {
    margin-top: 2rem;
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid var(--border);
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .75rem;
    color: var(--muted);
    margin: 0 0 .35rem;
}

.muted {
    color: var(--muted);
}

.chips {
    display: flex;
    gap: .6rem;
}

.chip {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: .2rem .9rem;
    font-size: .8rem;
}

.chip.large {
    font-size: 1rem;
    padding: .35rem 1.2rem;
}

.phases-timeline {
    margin-top: 2rem;
    display: grid;
    gap: 1rem;
}

.phase-card {
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 18px;
}

.phase-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status {
    border-radius: 999px;
    padding: .2rem .9rem;
    font-size: .8rem;
    background: var(--primary-soft);
    color: var(--primary);
}

.status-primary {
    background: rgba(80, 48, 229, 0.15);
}

.status-zavrseno { background: rgba(47, 179, 68, 0.15); color: var(--success); }
.status-ceka-odobrenje { background: rgba(245, 179, 0, 0.15); color: var(--warning); }
.status-u-toku { background: rgba(80, 48, 229, 0.12); color: var(--primary); }
.status-na-cekanju { background: rgba(240, 132, 40, 0.15); color: #e88307; }
.status-slijedi { background: rgba(15, 23, 61, 0.08); color: #3d4354; }
.status-odobreno { background: rgba(47, 179, 68, 0.15); color: var(--success); }
.status-odbijeno,
.status-odbijen { background: rgba(240, 61, 61, 0.16); color: var(--danger); }
.status-draft { background: rgba(99, 102, 241, 0.1); color: #4f46e5; }
.status-in-progress { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; }
.status-waiting-approval { background: rgba(245, 179, 0, 0.15); color: var(--warning); }
.status-completed { background: rgba(47, 179, 68, 0.15); color: var(--success); }
.status-on-hold { background: rgba(249, 115, 22, 0.15); color: #ea580c; }
.status-cancelled { background: rgba(15, 23, 42, 0.1); color: #475569; }
.status-planirano { background: rgba(148, 163, 184, 0.2); color: #475569; }

.phase-meta {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .4rem;
    margin: 1rem 0;
}

.phase-tasks {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.task-pill {
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: .4rem .8rem;
    display: flex;
    gap: .4rem;
    align-items: center;
    font-size: .85rem;
}

.messaging-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.message-status-legend {
    list-style: none;
    display: flex;
    gap: 1rem;
    padding: 0;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-flex;
    margin-right: .4rem;
    background: var(--muted);
}

.dot.online {
    background: var(--success);
}

.dot.away {
    background: var(--info);
}

.dot.offline {
    background: var(--muted);
}

.pill {
    border-radius: 30px;
    padding: .15rem .7rem;
    font-size: .8rem;
}

.pill.read {
    background: rgba(47, 179, 68, 0.15);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    padding: 0 .4rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--danger);
    color: #fff;
}

.badge.sm {
    min-width: 18px;
    padding: 0 .35rem;
    font-size: .7rem;
}

.notify-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-right: .9rem;
    color: var(--text);
}

.notify-link .icon {
    font-size: 1rem;
}

.notify-link .badge {
    position: absolute;
    top: -4px;
    right: -4px;
}

.pill.delivered {
    background: rgba(52, 140, 255, 0.15);
}

.auth-card {
    max-width: 420px;
    margin: 2rem auto;
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid var(--border);
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.inline-checkbox {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    color: var(--muted);
}

.form-grid.compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.form-grid.compact label {
    margin-bottom: 0;
}

input,
textarea,
select {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: .7rem;
    font-size: 1rem;
}

select {
    background: #fff;
}

button.primary {
    padding: .85rem;
    background: var(--primary);
    border: none;
    color: #fff;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.alert.error {
    background: rgba(240, 61, 61, 0.12);
    color: var(--danger);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border-radius: 18px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.messages-card {
    height: 100%;
}

.project-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.phase-row {
    border-bottom: 1px dashed var(--border);
    padding: .8rem 0;
}

.phase-row:last-child {
    border-bottom: none;
}

.phase-row .line {
    display: flex;
    justify-content: space-between;
    font-size: .9rem;
    color: var(--muted);
}

.tag {
    padding: .1rem .6rem;
    border-radius: 10px;
    background: var(--primary-soft);
}

.recent-projects ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .8rem;
}

.recent-projects li {
    border-bottom: 1px solid var(--border);
    padding-bottom: .6rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.recent-projects li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recent-meta {
    display: flex;
    gap: .5rem;
    align-items: center;
    font-size: .85rem;
    color: var(--muted);
}

.conversation-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.conversation-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.conversation-list a {
    width: 100%;
    justify-content: space-between;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message-thread {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 50vh;
    overflow-y: auto;
}

.bubble {
    background: #fff;
    border-radius: 12px;
    padding: .9rem 1rem;
    border: 1px solid var(--border);
    min-width: 300px;
}

.bubble-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: .4rem;
    font-size: .9rem;
    color: var(--muted);
}

.bubble-head .status-label {
    font-size: .5rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.message-form textarea {
    resize: none;
}

.time {
    font-size: .65rem;
}

.message-form button {
    width: 100%;
    margin-top: .8rem;
}

.project-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid var(--border);
}

.project-timeline {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    padding: 0;
    margin: 1rem 0 0;
    color: var(--muted);
}

.project-body {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.phase-detail {
    background: #fff;
    border-radius: 18px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    max-height: 110vh;
    overflow-y: auto;
}

.phase-detail header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.phase-status-block {
    text-align: right;
    font-size: .85rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: .3rem;
    align-items: flex-end;
}

.attachments ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.workflow {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.workflow-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.tasks-list {
    margin-top: 1rem;
}

.tasks-list .task-row {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--border);
    border-radius: 16px;
    margin: 1rem 0;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(80, 48, 229, 0.02);
    box-shadow: inset 0 0 0 1px rgba(80, 48, 229, 0.05);
}

.tasks-list .task-row:last-child {
    border-bottom: none;
}

.task-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.task-form {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.task-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
}

.task-delete {
    margin-top: .6rem;
    align-self: flex-end;
}

.mini-attachments {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    padding: 0;
    margin: .6rem 0;
}

.upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .6rem;
}

.status.sm {
    font-size: .75rem;
    padding: .1rem .6rem;
}

.project-sidebar .card {
    margin-bottom: 1rem;
}

.approval-flow ol {
    padding-left: 1.2rem;
}

.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    font-size: .9rem;
    border-top: 1px solid var(--border);
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--border);
    padding: .75rem .5rem;
    text-align: left;
}

.data-table th {
    text-transform: uppercase;
    font-size: .8rem;
    letter-spacing: .08em;
    color: var(--muted);
}

.table-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.table-actions form {
    margin: 0;
}

.message-panel {
    display: grid;
    gap: 1.5rem;
}

.thread-wrapper {
    max-height: 40vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem;
    background: var(--surface);
}

.message-thread.admin-thread li.self {
    align-self: flex-end;
    display: flex;
    justify-content: flex-end;
}

.message-thread.admin-thread li.other {
    align-self: flex-start;
    display: flex;
    justify-content: flex-start;
}

.bubble.admin {
    background: rgba(80, 48, 229, 0.08);
    border-color: rgba(80, 48, 229, 0.25);
}

.bubble.client {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
}

.admin-compose textarea {
    resize: none;
}

.compose-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .8rem;
}

.indicator {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--muted);
    margin: auto 0;
}

.presence-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.5rem;
    margin-bottom: 1rem;
    font-size: .85rem;
    color: var(--muted);
}

.messages-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.project-filter select {
    min-width: 220px;
}

.table-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    width: auto;
}

.table-actions form {
    margin: 0;
}

.admin-layout {
    background: var(--bg);
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.admin-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(70vh - 80px);
}

.admin-sidebar {
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.admin-sidebar a {
    padding: .6rem 1rem;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.admin-content {
    padding: 2rem;
}

.small {
    max-width: 160px;
}
.tiny {
    font-size: 0.75rem;
    color: #5d6470;
}

.recent-projects {
    margin-top: 15px;
}

@media (max-width: 980px) {
    .dashboard-grid,
    .project-body,
    .project-hero {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .site-header {
        flex-direction: column;
        gap: 1rem;
    }

    .page-shell {
        padding: 2rem;
    }

    .admin-container {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: .4rem;
    }
}
