:root {
    --tp-brand: #0b4bd6;
    --tp-brand-dark: #0839a8;
    --tp-brand-soft: #e8effc;
    --tp-ink: #1c2430;
    --tp-muted: #6b7785;
    --tp-border: #e4e8ee;
    --tp-bg: #f5f7fb;
    --tp-surface: #ffffff;
    --tp-sidebar-width: 250px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Roboto", sans-serif;
    color: var(--tp-ink);
    background: var(--tp-bg);
    min-height: 100vh;
}

a {
    color: var(--tp-brand);
    text-decoration: none;
}

a:hover {
    color: var(--tp-brand-dark);
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    width: var(--tp-sidebar-width);
    background: var(--tp-surface);
    border-right: 1px solid var(--tp-border);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform .2s ease;
}

.sidebar-brand {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--tp-border);
}

.sidebar-brand img {
    height: 36px;
    width: auto;
}

.sidebar-nav {
    padding: 1rem .75rem;
    overflow-y: auto;
    flex: 1;
}

.sidebar-divider {
    height: 1px;
    background: var(--tp-border);
    margin: .65rem .35rem;
}

.list-toolbar {
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: .85rem;
    padding: .85rem 1rem;
}

.list-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
}

.list-search {
    position: relative;
    flex: 1 1 240px;
    min-width: 200px;
}

.list-search .fa-magnifying-glass {
    position: absolute;
    left: .9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tp-muted);
    font-size: .85rem;
    pointer-events: none;
}

.list-search .form-control {
    padding-left: 2.35rem;
    padding-right: 2.2rem;
    border-radius: .65rem;
    border-color: var(--tp-border);
    background: #fbfcfe;
    min-height: 42px;
}

.list-search .form-control:focus {
    background: #fff;
    border-color: #9bb6ef;
    box-shadow: 0 0 0 .2rem rgba(11, 75, 214, .12);
}

.list-search-clear {
    position: absolute;
    right: .65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tp-muted);
    border: 0;
    background: transparent;
    padding: 0;
    line-height: 1;
    text-decoration: none;
}

.list-search-clear:hover {
    color: var(--tp-ink);
}

.list-toolbar .form-select {
    flex: 0 1 180px;
    min-width: 150px;
    border-radius: .65rem;
    border-color: var(--tp-border);
    background-color: #fbfcfe;
    min-height: 42px;
}

.list-toolbar .form-select:focus {
    border-color: #9bb6ef;
    box-shadow: 0 0 0 .2rem rgba(11, 75, 214, .12);
}

.pagination {
    --bs-pagination-border-radius: .5rem;
    --bs-pagination-color: var(--tp-ink);
    --bs-pagination-hover-color: var(--tp-brand-dark);
    --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(11, 75, 214, .12);
    --bs-pagination-active-bg: var(--tp-brand);
    --bs-pagination-active-border-color: var(--tp-brand);
    gap: .25rem;
}

.pagination .page-link {
    border-radius: .5rem !important;
    margin: 0;
}

.chart-card {
    min-height: 100%;
}

.chart-wrap {
    position: relative;
    width: 100%;
}

.chart-wrap-line {
    height: 280px;
}

.chart-wrap-pie {
    height: 260px;
    max-width: 320px;
    margin: 0 auto;
}

.sidebar-nav .nav-link {
    color: var(--tp-ink);
    border-radius: .5rem;
    padding: .65rem .85rem;
    margin-bottom: .2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: var(--tp-brand-soft);
    color: var(--tp-brand-dark);
}

.main-content {
    margin-left: var(--tp-sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: var(--tp-surface);
    border-bottom: 1px solid var(--tp-border);
    padding: .85rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.page-content {
    padding: 1.25rem;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top right, rgba(11, 75, 214, .14), transparent 40%),
        linear-gradient(180deg, #f7f9fd 0%, #eef2fb 100%);
    padding: 1.5rem;
}

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

.auth-logo {
    height: 42px;
    width: auto;
    margin-bottom: 1.25rem;
}

.surface {
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: .85rem;
}

.stat-tile {
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: .85rem;
    padding: 1rem 1.1rem;
}

.stat-tile .label {
    color: var(--tp-muted);
    font-size: .85rem;
}

.stat-tile .value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: .2rem;
}

.summary-card {
    height: 100%;
}

a.summary-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

a.summary-card-link:hover {
    border-color: #9bb6ef;
    box-shadow: 0 0 0 .15rem rgba(11, 75, 214, .08);
    color: inherit;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .55rem;
    line-height: 1.4;
}

.project-meta .meta-sep {
    color: #c0c7d1;
}

.project-meta .bi {
    margin-right: .2rem;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.page-subtitle {
    color: var(--tp-muted);
    margin: .25rem 0 0;
}

.btn-brand {
    background: var(--tp-brand);
    border-color: var(--tp-brand);
    color: #fff;
}

.btn-brand:hover,
.btn-brand:focus {
    background: var(--tp-brand-dark);
    border-color: var(--tp-brand-dark);
    color: #fff;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.badge-soft {
    background: var(--tp-brand-soft);
    color: var(--tp-brand-dark);
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--tp-muted);
}

.comment-item,
.activity-item,
.attachment-item {
    border-bottom: 1px solid var(--tp-border);
    padding: .9rem 0;
}

.comment-item:last-child,
.activity-item:last-child,
.attachment-item:last-child {
    border-bottom: 0;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    opacity: 0;
    transition: opacity .15s ease;
}

.comment-item:hover .comment-actions,
.comment-item:focus-within .comment-actions {
    opacity: 1;
}

.comment-action-btn {
    border: 0;
    background: transparent;
    color: var(--tp-muted);
    font-size: .82rem;
    padding: 0;
    cursor: pointer;
}

.comment-action-btn:hover {
    color: var(--tp-brand-dark);
    text-decoration: underline;
}

.comment-action-danger:hover {
    color: #b42318;
}

.comment-action-sep {
    color: #c0c7d1;
    font-size: .82rem;
}

.btn i.fa-solid,
.btn i.fa-regular {
    margin-right: .35rem;
}

.btn-icon-only i.fa-solid {
    margin-right: 0;
}

.ref-id {
    display: inline-block;
    font-family: "Roboto Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--tp-brand-dark);
    background: var(--tp-brand-soft);
    border: 1px solid #c9d8f7;
    border-radius: .35rem;
    padding: .15rem .45rem;
    line-height: 1.2;
    white-space: nowrap;
}

.ref-id-muted {
    background: #f1f4f7;
    border-color: var(--tp-border);
    color: var(--tp-muted);
}

.ref-title {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
}

.page-title .ref-id {
    font-size: .85rem;
    vertical-align: middle;
    margin-right: .35rem;
}

.badge {
    align-self: flex-start;
    height: fit-content;
    line-height: 1.2;
    padding: .35em .65em;
}

.user-avatar-wrap {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    letter-spacing: .02em;
    flex-shrink: 0;
    text-transform: uppercase;
    line-height: 1;
}

.user-avatar-sm {
    width: 34px;
    height: 34px;
    font-size: .72rem;
}

.user-avatar-md {
    width: 40px;
    height: 40px;
    font-size: .8rem;
}

.user-avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.15rem;
}

.user-avatar-name {
    font-weight: 500;
}

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    border: 1px solid var(--tp-border);
    background: var(--tp-surface);
    border-radius: .7rem;
    padding: .35rem .7rem .35rem .4rem;
}

.user-menu-btn:hover,
.user-menu-btn:focus,
.user-menu-btn.show {
    background: var(--tp-brand-soft);
    border-color: #c9d8f7;
}

.user-menu-btn::after {
    margin-left: .15rem;
}

.user-menu-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.user-menu-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--tp-ink);
}

.user-menu-role {
    font-size: .72rem;
    color: var(--tp-muted);
}

.user-menu-dropdown {
    min-width: 220px;
    border: 1px solid var(--tp-border);
    border-radius: .75rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
    padding: .4rem;
}

.user-menu-dropdown .dropdown-item {
    border-radius: .5rem;
    padding: .55rem .75rem;
    font-weight: 500;
}

.user-menu-dropdown .dropdown-item i {
    width: 1.1rem;
    margin-right: .45rem;
}

@media (max-width: 575.98px) {
    .user-menu-meta {
        display: none;
    }

    .user-menu-btn {
        padding: .3rem;
    }

    .user-menu-btn::after {
        display: none;
    }
}

.gantt-pending { background: #94a3b8 !important; }
.gantt-working { background: #3b82f6 !important; }
.gantt-in_review { background: #f59e0b !important; }
.gantt-completed { background: #16a34a !important; }

#gantt-root {
    overflow-x: auto;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .35);
    z-index: 1025;
}

.sidebar-backdrop.show {
    display: block;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .comment-actions {
        opacity: 1;
    }
}
