:root {
    --app-bg: #f5f7fb;
    --app-ink: #1f2937;
    --app-muted: #64748b;
    --app-line: #e5e7eb;
    --app-primary: #2563eb;
    --app-teal: #0f766e;
    --app-amber: #d97706;
    --app-green: #15803d;
    --app-red: #dc2626;
}

* {
    letter-spacing: 0;
}

body {
    background: var(--app-bg);
    color: var(--app-ink);
    font-size: 15px;
}

.app-navbar {
    background: #0b3b5f;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.app-navbar .navbar-brand,
.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.84);
}

.app-navbar .navbar-brand {
    max-width: 380px;
}

.app-navbar .navbar-brand span:last-child {
    display: grid;
    font-weight: 700;
    line-height: 1.15;
}

.app-navbar .navbar-brand small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.72rem;
    font-weight: 500;
}

.app-navbar .nav-link {
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0.1rem;
}

.app-navbar .nav-link.active,
.app-navbar .nav-link:hover,
.app-navbar .navbar-brand:hover {
    color: #fff;
}

.app-navbar .nav-link.active {
    background: rgba(255, 255, 255, 0.14);
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.25);
}

.navbar-toggler-icon {
    filter: invert(1);
}

.brand-mark {
    align-items: center;
    background: #ffffff;
    border-radius: 8px;
    color: #0b3b5f;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.brand-logo,
.login-logo {
    align-items: center;
    background: #ffffff;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    overflow: hidden;
}

.brand-logo {
    flex: 0 0 42px;
    height: 42px;
    width: 42px;
}

.brand-logo img,
.login-logo img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.user-chip {
    align-items: center;
    color: #fff;
    display: flex;
    gap: 0.75rem;
}

.user-chip strong,
.user-chip span {
    display: block;
    line-height: 1.2;
}

.user-chip span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
}

.page-heading {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-heading h1 {
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0;
}

.page-heading p {
    color: var(--app-muted);
    margin: 0.25rem 0 0;
}

.panel {
    background: #fff;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
    padding: 1.1rem;
}

.panel-title {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-title h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.panel-title a {
    font-size: 0.9rem;
    text-decoration: none;
}

.metric-card {
    align-items: center;
    background: #fff;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    display: flex;
    gap: 0.8rem;
    min-height: 92px;
    padding: 1rem;
}

.metric-card > span {
    align-items: center;
    border-radius: 8px;
    color: #fff;
    display: flex;
    flex: 0 0 42px;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.metric-card strong,
.metric-card small {
    display: block;
}

.metric-card strong {
    font-size: 1.5rem;
    line-height: 1;
}

.metric-card small {
    color: var(--app-muted);
    margin-top: 0.25rem;
}

.metric-blue > span {
    background: var(--app-primary);
}

.metric-cyan > span {
    background: var(--app-teal);
}

.metric-amber > span {
    background: var(--app-amber);
}

.metric-green > span {
    background: var(--app-green);
}

.metric-red > span {
    background: var(--app-red);
}

.chart-box {
    min-height: 290px;
}

.legacy-summary {
    background: #f7f7f7;
}

.legacy-tabs {
    border-bottom: 2px solid #0b3b5f;
    display: flex;
    gap: 1.5rem;
    margin: -0.25rem 0 1.25rem;
    padding: 0 0.25rem;
}

.legacy-tabs a,
.legacy-tabs span {
    color: #334155;
    display: inline-flex;
    font-weight: 600;
    padding: 0.35rem 0.25rem 0.55rem;
    text-decoration: none;
}

.legacy-tabs a:hover {
    color: #0b3b5f;
}

.legacy-tabs .active {
    color: #0b3b5f;
}

.legacy-filter {
    margin-bottom: 1.85rem;
}

.legacy-time-filter {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(150px, 0.9fr) repeat(2, minmax(150px, 1fr));
}

.legacy-kpis {
    align-items: stretch;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    margin-bottom: 1.8rem;
}

.legacy-kpi {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #0d9488;
    border-radius: 8px;
    box-shadow: 0 10px 18px rgba(13, 148, 136, 0.10);
    display: grid;
    justify-items: center;
    min-height: 112px;
    padding: 0.7rem;
    text-align: center;
}

.legacy-kpi-link {
    color: inherit;
    text-decoration: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.legacy-kpi-link:hover {
    border-color: #dc2626;
    box-shadow: 0 12px 22px rgba(220, 38, 38, 0.15);
    color: inherit;
    transform: translateY(-1px);
}

.legacy-kpi span {
    color: #334155;
    font-size: 0.92rem;
    font-weight: 700;
}

.legacy-kpi strong {
    color: #0d6efd;
    font-size: 2.45rem;
    font-weight: 800;
    line-height: 1;
}

.legacy-kpi-total strong {
    color: #dc2626;
    font-size: 2.85rem;
}

.legacy-chart-title {
    color: #1f2937;
    font-weight: 800;
    margin-bottom: 0.75rem;
    text-align: center;
}

.legacy-chart-box {
    min-height: 360px;
    position: relative;
}

.task-table td,
.task-table th {
    white-space: nowrap;
}

.task-table td:first-child,
.task-table th:first-child {
    min-width: 280px;
    white-space: normal;
}

.progress-cell {
    min-width: 150px;
}

.progress-cell .progress {
    display: inline-flex;
    height: 8px;
    margin-right: 0.35rem;
    width: 90px;
}

.task-form textarea {
    resize: vertical;
}

.task-edit-context {
    background: #f8fafc;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 1rem;
}

.task-edit-context span {
    color: var(--app-muted);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.task-edit-context strong {
    color: var(--app-text);
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    min-height: 1.25rem;
}

.leader-field .empty-leader-note {
    display: none;
}

.leader-field.is-empty .empty-leader-note {
    display: block;
}

.detail-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.detail-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
}

.detail-grid div {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    padding: 0.8rem;
}

.detail-grid dt {
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.detail-grid dd {
    font-weight: 700;
    margin: 0.15rem 0 0;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 1rem 0 0.4rem;
}

.preserve-lines {
    white-space: pre-line;
}

.timeline {
    border-left: 2px solid var(--app-line);
    margin-left: 0.45rem;
    padding-left: 1rem;
}

.timeline-item {
    margin-bottom: 1rem;
    position: relative;
}

.timeline-item::before {
    background: var(--app-primary);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--app-primary);
    content: "";
    height: 10px;
    left: -1.38rem;
    position: absolute;
    top: 0.35rem;
    width: 10px;
}

.timeline-item strong,
.timeline-item span {
    display: block;
}

.timeline-item span {
    color: var(--app-muted);
    font-size: 0.78rem;
}

.timeline-item p {
    margin: 0.25rem 0 0;
}

.login-page {
    background: #eef4f8;
    min-height: 100vh;
}

.login-shell {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: 1rem;
}

.login-panel {
    background: #fff;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.13);
    margin: 0 auto;
    max-width: 430px;
    padding: 1.75rem;
    width: 100%;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: 0.85rem;
    margin-bottom: 1.35rem;
}

.login-logo {
    border: 1px solid var(--app-line);
    flex: 0 0 52px;
    height: 52px;
    width: 52px;
}

.login-brand h1 {
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0;
}

.login-brand p {
    color: var(--app-muted);
    font-weight: 600;
    margin: 0.2rem 0 0;
}

.login-brand small {
    color: var(--app-muted);
    display: block;
    font-size: 0.82rem;
    line-height: 1.3;
    margin-top: 0.1rem;
}

.demo-account {
    border-top: 1px solid var(--app-line);
    color: var(--app-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
}

@media (max-width: 991.98px) {
    .page-heading {
        display: block;
    }

    .page-heading .btn,
    .page-heading .d-flex {
        margin-top: 1rem;
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .task-edit-context {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-chip {
        align-items: flex-start;
        margin-top: 0.75rem;
    }

    .legacy-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .legacy-time-filter {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .task-edit-context {
        grid-template-columns: 1fr;
    }

    .panel,
    .login-panel {
        padding: 1rem;
    }

    .legacy-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .legacy-time-filter {
        grid-template-columns: 1fr;
    }

    .legacy-kpi {
        min-height: 96px;
    }

    .legacy-kpi strong,
    .legacy-kpi-total strong {
        font-size: 2rem;
    }
}
