:root,
[data-bs-theme="light"] {
    --app-bg: #f3f5fa;
    --app-surface: #ffffff;
    --app-surface-2: #f8fafc;
    --app-text: #0f172a;
    --app-muted: #64748b;
    --app-border: #e2e8f0;
    --app-sidebar: #0f172a;
    --app-sidebar-text: #cbd5e1;
    --app-sidebar-active: #ffffff;
    --app-primary: #2563eb;
    --app-primary-soft: #dbeafe;
    --app-success: #059669;
    --app-success-soft: #d1fae5;
    --app-warning: #d97706;
    --app-warning-soft: #fef3c7;
    --app-info: #0891b2;
    --app-info-soft: #cffafe;
    --app-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    --app-radius: 14px;
}

[data-bs-theme="dark"] {
    --app-bg: #0b1220;
    --app-surface: #111827;
    --app-surface-2: #1f2937;
    --app-text: #e5e7eb;
    --app-muted: #94a3b8;
    --app-border: #243044;
    --app-sidebar: #020617;
    --app-sidebar-text: #94a3b8;
    --app-sidebar-active: #f8fafc;
    --app-primary: #60a5fa;
    --app-primary-soft: rgba(37, 99, 235, 0.22);
    --app-success: #34d399;
    --app-success-soft: rgba(5, 150, 105, 0.2);
    --app-warning: #fbbf24;
    --app-warning-soft: rgba(217, 119, 6, 0.2);
    --app-info: #22d3ee;
    --app-info-soft: rgba(8, 145, 178, 0.2);
    --app-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
    background: var(--app-bg);
    color: var(--app-text);
}

a {
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar,
.app-offcanvas {
    width: 260px;
    background: var(--app-sidebar);
    color: var(--app-sidebar-text);
    flex-direction: column;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.25rem 0.85rem;
    overflow-y: auto;
}

.app-offcanvas {
    background: var(--app-sidebar) !important;
    color: var(--app-sidebar-text);
}

.app-offcanvas .btn-close {
    filter: invert(1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.7rem 1.25rem;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
    line-height: 1.2;
}

.sidebar-brand strong {
    color: #fff;
    font-size: 0.95rem;
}

.sidebar-brand small {
    color: #94a3b8;
    font-size: 0.75rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 0.45rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--app-sidebar-text);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
    width: 1.2rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--app-sidebar-active);
}

.sidebar-nav .nav-link.active {
    background: var(--app-primary);
    color: #fff;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-title {
    font-size: 1.15rem;
    margin: 0;
    font-weight: 700;
}

.page-subtitle {
    margin: 0;
    color: var(--app-muted);
    font-size: 0.85rem;
}

.btn-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    border-radius: 12px;
}

.btn-icon:hover {
    background: var(--app-surface-2);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    border-radius: 999px;
    padding: 0.25rem 0.7rem 0.25rem 0.25rem;
}

.user-chip::after {
    display: none;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--app-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.user-meta {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.user-meta small {
    color: var(--app-muted);
    font-size: 0.75rem;
}

.app-content {
    padding: 1.25rem;
    flex: 1;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem 1.25rem;
    color: var(--app-muted);
    font-size: 0.85rem;
}

.app-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
    background: var(--app-surface);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.2rem;
    height: 100%;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--app-primary-soft); color: var(--app-primary); }
.stat-icon.green { background: var(--app-success-soft); color: var(--app-success); }
.stat-icon.amber { background: var(--app-warning-soft); color: var(--app-warning); }
.stat-icon.cyan { background: var(--app-info-soft); color: var(--app-info); }
.stat-icon.red { background: rgba(220, 38, 38, 0.12); color: #dc2626; }

[data-bs-theme="dark"] .stat-icon.red {
    background: rgba(220, 38, 38, 0.22);
    color: #f87171;
}

.stat-label {
    color: var(--app-muted);
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.welcome-card {
    background: linear-gradient(135deg, #1d4ed8, #2563eb 55%, #0ea5e9);
    color: #fff;
    border: 0;
}

.welcome-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

.welcome-card p {
    overflow-wrap: anywhere;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-table {
    margin: 0;
    color: var(--app-text);
}

.app-table > :not(caption) > * > * {
    background-color: transparent;
    color: var(--app-text);
    border-bottom-color: var(--app-border);
}

.app-table th {
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--app-muted);
    white-space: nowrap;
}

.app-table tbody tr:hover > * {
    background-color: var(--app-surface-2);
}

.login-body {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 28%),
        var(--app-bg);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    box-shadow: var(--app-shadow);
    background: var(--app-surface);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-control,
.form-select,
.form-check-input {
    border-color: var(--app-border);
    background-color: var(--app-surface);
    color: var(--app-text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
    background-color: var(--app-surface);
    color: var(--app-text);
}

.btn-primary {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.login-theme {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

@media (max-width: 991.98px) {
    .app-content {
        padding: 1rem;
    }

    .app-topbar {
        padding: 0.85rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .stat-value {
        font-size: 1.4rem;
    }

    .app-footer {
        flex-direction: column;
        gap: 0.25rem;
    }

    .detail-list > div {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}

.empty-state {
    text-align: center;
    padding: 3rem 1.25rem;
    color: var(--app-muted);
}

.empty-state i {
    font-size: 2rem;
    color: var(--app-primary);
}

.usage-meter {
    min-width: 90px;
    max-width: 160px;
}

.usage-progress {
    height: 6px;
    background: var(--app-surface-2);
}

.usage-caption {
    font-size: 0.75rem;
    color: var(--app-muted);
    margin-top: 0.25rem;
}

.client-name {
    font-weight: 600;
    color: var(--app-text);
}

.client-company {
    font-size: 0.8rem;
    color: var(--app-muted);
}

.client-result-count {
    font-size: 0.82rem;
    color: var(--app-muted);
    margin-top: 0.15rem;
}

.client-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.client-card {
    display: flex;
    flex-direction: column;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: 1rem 1.05rem 0.9rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    min-height: 100%;
    transition: box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.client-card:hover {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.client-card.is-inactive {
    opacity: 0.82;
}

.client-card.is-critical {
    border-color: #fecaca;
}

.client-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.7rem;
}

.client-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    text-decoration: none;
}

.client-avatar.tone-0 { background: #dbeafe; color: #1d4ed8; }
.client-avatar.tone-1 { background: #cffafe; color: #0e7490; }
.client-avatar.tone-2 { background: #fef3c7; color: #b45309; }
.client-avatar.tone-3 { background: #ede9fe; color: #6d28d9; }
.client-avatar.tone-4 { background: #fce7f3; color: #be185d; }
.client-avatar.tone-5 { background: #d1fae5; color: #047857; }

.client-card-identity {
    min-width: 0;
    flex: 1;
}

.client-card .client-name {
    display: block;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-card .client-name:hover {
    color: var(--app-primary);
}

.client-card .client-company {
    margin-top: 0.12rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.client-chip {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    line-height: 1.2;
    background: #f1f5f9;
    color: #475569;
}

.client-chip.type-maintenance {
    background: #ecfeff;
    color: #0e7490;
}

.client-chip.type-new_project {
    background: #eff6ff;
    color: #1d4ed8;
}

.client-chip.type-both {
    background: #f5f3ff;
    color: #6d28d9;
}

.client-chip.status-active {
    background: #ecfdf5;
    color: #047857;
}

.client-chip.status-inactive {
    background: #f1f5f9;
    color: #64748b;
}

.client-web {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--app-primary);
    text-decoration: none;
    margin-bottom: 0.75rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-web:hover {
    text-decoration: underline;
}

.client-web.is-empty {
    color: var(--app-muted);
}

.client-card-hours {
    margin-top: auto;
    padding-top: 0.15rem;
}

.client-hours-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--app-muted);
    margin-bottom: 0.35rem;
}

.client-hours-row strong {
    font-size: 0.8rem;
    color: var(--app-text);
}

.client-hours-row strong.is-critical {
    color: #b91c1c;
}

.client-card .usage-meter {
    margin-bottom: 0.3rem;
}

.client-hours-meta,
.client-hours-empty {
    font-size: 0.75rem;
    color: var(--app-muted);
    line-height: 1.35;
}

.client-card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--app-border);
}

.client-view {
    display: inline-flex;
    align-items: center;
    margin-right: auto;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-radius: 8px;
    padding: 0.28rem 0.6rem;
    line-height: 1.3;
    text-decoration: none;
}

.client-view:hover {
    color: #fff;
    background: var(--app-primary);
}

[data-bs-theme="dark"] .client-avatar.tone-0 { background: rgba(37, 99, 235, 0.22); color: #93c5fd; }
[data-bs-theme="dark"] .client-avatar.tone-1 { background: rgba(8, 145, 178, 0.22); color: #67e8f9; }
[data-bs-theme="dark"] .client-avatar.tone-2 { background: rgba(217, 119, 6, 0.22); color: #fcd34d; }
[data-bs-theme="dark"] .client-avatar.tone-3 { background: rgba(109, 40, 217, 0.22); color: #c4b5fd; }
[data-bs-theme="dark"] .client-avatar.tone-4 { background: rgba(190, 24, 93, 0.22); color: #f9a8d4; }
[data-bs-theme="dark"] .client-avatar.tone-5 { background: rgba(5, 150, 105, 0.22); color: #6ee7b7; }

[data-bs-theme="dark"] .client-chip {
    background: #1f2937;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .client-chip.type-maintenance { background: rgba(8, 145, 178, 0.22); color: #67e8f9; }
[data-bs-theme="dark"] .client-chip.type-new_project { background: rgba(37, 99, 235, 0.22); color: #93c5fd; }
[data-bs-theme="dark"] .client-chip.type-both { background: rgba(109, 40, 217, 0.22); color: #c4b5fd; }
[data-bs-theme="dark"] .client-chip.status-active { background: rgba(5, 150, 105, 0.22); color: #6ee7b7; }

[data-bs-theme="dark"] .client-card.is-critical {
    border-color: #7f1d1d;
}

[data-bs-theme="dark"] .client-hours-row strong.is-critical {
    color: #fca5a5;
}

@media (max-width: 575.98px) {
    .client-board {
        grid-template-columns: 1fr;
    }
}

.detail-list {
    display: grid;
    gap: 0.85rem;
}

.detail-list > div {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.75rem;
}

.detail-list dt {
    color: var(--app-muted);
    font-weight: 500;
    margin: 0;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.task-title {
    font-weight: 600;
    color: var(--app-text);
}

.task-title:hover {
    color: var(--app-primary);
}

.task-description {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.comment-list {
    border-top: 1px solid var(--app-border);
}

.comment-item {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--app-border);
}

.comment-item:last-child {
    border-bottom: 0;
}

.comment-meta {
    font-size: 0.8rem;
    color: var(--app-muted);
    white-space: nowrap;
}

.attachment-list {
    border-top: 1px solid var(--app-border);
}

.attachment-item {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--app-border);
}

.attachment-item:last-child {
    border-bottom: 0;
}

.attachment-meta {
    font-size: 0.85rem;
    color: var(--app-muted);
}

.timer-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 280px;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface-2);
    color: var(--app-text);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
}

.timer-chip:hover {
    color: var(--app-primary);
    border-color: var(--app-primary);
}

.timer-chip-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.checklist-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.checklist-pills li {
    font-size: 0.85rem;
}

.checklist-pills .is-done {
    color: var(--app-success);
}

.checklist-pills .is-open {
    color: var(--app-muted);
}

.report-link-card:hover {
    border-color: var(--app-primary);
}

.report-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--app-muted);
}

.report-subject-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.report-kpi-grid-screen {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.report-kpi {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.report-kpi span {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--app-muted);
    margin-bottom: 0.3rem;
}

.report-kpi strong {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.25;
}

.report-print-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    margin-top: 0.35rem;
}

.report-print-sub {
    margin: 0.2rem 0 0;
    color: #6b7280;
}

.report-print-note {
    font-size: 0.82rem;
    color: #6b7280;
    margin: 0.25rem 0 0;
}

.report-print-page .report-kpi {
    background: #f8fafc;
    border-color: #e5e7eb;
}

.report-print-masthead h1 {
    font-size: 1.7rem;
}

.timer-elapsed {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.timer-elapsed-wrap {
    font-variant-numeric: tabular-nums;
}

#timerCheckModal .modal-title {
    font-weight: 700;
}

#timerConfirmCountdown,
#timerModalCountdown {
    font-variant-numeric: tabular-nums;
}

.js-live-elapsed {
    font-variant-numeric: tabular-nums;
}

a.card.app-card:hover {
    border-color: var(--app-primary);
}

@media (max-width: 575.98px) {
    .timer-chip-title {
        display: none;
    }

    .timer-chip {
        max-width: none;
    }

    .timer-elapsed {
        font-size: 1.15rem;
    }
}

.app-breadcrumb .breadcrumb {
    margin-bottom: 1rem;
    background: transparent;
    padding: 0;
}

.app-breadcrumb .breadcrumb-item,
.app-breadcrumb .breadcrumb-item a {
    color: var(--app-muted);
    font-size: 0.85rem;
}

.app-breadcrumb .breadcrumb-item.active {
    color: var(--app-text);
}

.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: var(--app-muted);
}

.sidebar-nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    padding: 0.9rem 0.85rem 0.2rem;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.btn-icon-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.req-star {
    color: #dc2626;
}

.form-label {
    font-weight: 500;
    color: var(--app-text);
}

.filter-actions .btn {
    min-width: 5.5rem;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.hours-highlight {
    font-size: 1.15rem;
    font-weight: 700;
}

.hours-highlight.is-critical {
    color: #dc2626;
}

[data-bs-theme="dark"] .hours-highlight.is-critical {
    color: #f87171;
}

.btn.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn.is-loading::after {
    content: "";
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    margin-left: 0.4rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: app-spin 0.6s linear infinite;
    vertical-align: -0.1em;
}

@keyframes app-spin {
    to { transform: rotate(360deg); }
}

.app-alert {
    display: flex;
    align-items: center;
}

.app-alert .btn-close {
    margin-left: auto;
}

.dropdown-menu {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

.dropdown-item {
    color: var(--app-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--app-surface-2);
    color: var(--app-text);
}

.modal-content {
    background: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}

.modal-header,
.modal-footer {
    border-color: var(--app-border);
}

.form-text {
    color: var(--app-muted);
}

.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

[data-bs-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-primary,
[data-bs-theme="dark"] .btn-outline-danger {
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .alert-success {
    background: var(--app-success-soft);
    color: var(--app-text);
    border-color: transparent;
}

[data-bs-theme="dark"] .alert-danger,
[data-bs-theme="dark"] .alert-warning {
    color: var(--app-text);
}

[data-bs-theme="dark"] .welcome-card {
    background: linear-gradient(135deg, #1e3a8a, #1d4ed8 55%, #0e7490);
}

[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(1);
}

.text-muted,
.form-text,
.page-subtitle {
    color: var(--app-muted) !important;
}

.form-control::placeholder {
    color: var(--app-muted);
    opacity: 0.75;
}

input[type="date"],
input[type="month"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: inherit;
}

[data-bs-theme="dark"] .form-check-input {
    background-color: var(--app-surface-2);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

[data-bs-theme="dark"] .offcanvas {
    --bs-offcanvas-bg: var(--app-sidebar);
    --bs-offcanvas-color: var(--app-sidebar-text);
}

[data-bs-theme="dark"] .badge.text-bg-light,
[data-bs-theme="dark"] .badge.text-bg-dark {
    color: #f8fafc;
}

.app-table tfoot td {
    border-top: 1px solid var(--app-border);
    background: var(--app-surface-2);
}

.invalid-feedback {
    font-size: 0.82rem;
}

.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    align-items: flex-start;
}

.kanban-column {
    flex: 1 0 240px;
    min-width: 240px;
    max-width: 320px;
    background: var(--app-surface-2, #f1f5f9);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.kanban-column.is-drop-target {
    outline: 2px dashed var(--app-primary);
    outline-offset: -4px;
    background: color-mix(in srgb, var(--app-primary) 8%, var(--app-surface-2, #f1f5f9));
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.75rem 0.35rem;
}

.kanban-column-header h2 {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0;
    font-weight: 700;
}

.kanban-count {
    background: var(--app-surface);
    border-radius: 999px;
    font-size: 0.78rem;
    min-width: 1.6rem;
    text-align: center;
    padding: 0.1rem 0.45rem;
    color: var(--app-muted);
}

.kanban-cards {
    padding: 0 0.6rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
    min-height: 120px;
}

.kanban-column-note {
    margin: 0 0.75rem 0.35rem;
    font-size: 0.72rem;
    color: var(--app-muted);
}

.kanban-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.7rem 0.7rem;
    font-size: 0.78rem;
}

.kanban-pager a {
    text-decoration: none;
}

.kanban-empty {
    color: var(--app-muted);
    font-size: 0.85rem;
    margin: 0.5rem 0 0;
}

.kanban-card {
    --kanban-priority: #94a3b8;
    position: relative;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-left: 3px solid var(--kanban-priority);
    border-radius: 12px;
    padding: 0.55rem 0.7rem 0.6rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    user-select: none;
    transition: box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.kanban-card.priority-low {
    --kanban-priority: #94a3b8;
}

.kanban-card.priority-medium {
    --kanban-priority: #3b82f6;
}

.kanban-card.priority-high {
    --kanban-priority: #f59e0b;
}

.kanban-card.priority-urgent {
    --kanban-priority: #ef4444;
}

.kanban-card.is-draggable {
    cursor: grab;
}

.kanban-card.is-draggable:active {
    cursor: grabbing;
}

.kanban-card:hover {
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.kanban-card.is-dragging {
    opacity: 0.38;
}

.kanban-card.is-overdue {
    border-color: #fecaca;
    background: color-mix(in srgb, #fef2f2 55%, var(--app-surface));
}

.kanban-card.is-due-soon {
    border-color: #fde68a;
}

.kanban-card-ghost {
    position: fixed;
    z-index: 4000;
    margin: 0;
    pointer-events: none;
    transform: rotate(2deg) scale(1.03);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    opacity: 0.96;
}

.kanban-card-top {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin-bottom: 0.28rem;
}

.kanban-grip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--app-muted);
    width: 1.25rem;
    min-height: 1.25rem;
    margin-left: -0.25rem;
    font-size: 1rem;
    cursor: grab;
    touch-action: none;
}

.kanban-id {
    flex: 1;
    min-width: 0;
    font-size: 0.68rem;
    color: var(--app-muted);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.kanban-priority {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 0.12rem 0.42rem;
    line-height: 1.2;
    background: #f1f5f9;
    color: #475569;
}

.kanban-card.priority-medium .kanban-priority {
    background: #eff6ff;
    color: #1d4ed8;
}

.kanban-card.priority-high .kanban-priority {
    background: #fffbeb;
    color: #b45309;
}

.kanban-card.priority-urgent .kanban-priority {
    background: #fef2f2;
    color: #b91c1c;
}

.kanban-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.28rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-title a {
    color: inherit;
    text-decoration: none;
}

.kanban-title a:hover {
    color: var(--app-primary);
}

.kanban-client {
    font-size: 0.78rem;
    color: var(--app-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.28rem 0 0.45rem;
}

.kanban-due {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.75rem;
    color: var(--app-muted);
    line-height: 1.2;
}

.kanban-due .bi {
    font-size: 0.78rem;
}

.kanban-card.is-overdue .kanban-due {
    color: #b91c1c;
}

.kanban-due-chip {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 0.08rem 0.4rem;
    line-height: 1.2;
}

.kanban-card.is-overdue .kanban-due-chip {
    background: #fee2e2;
    color: #b91c1c;
}

.kanban-card.is-due-soon .kanban-due-chip {
    background: #fef3c7;
    color: #b45309;
}

.kanban-view {
    display: inline-flex;
    align-items: center;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border: 0;
    border-radius: 8px;
    padding: 0.22rem 0.55rem;
    line-height: 1.3;
}

.kanban-view:hover {
    color: #fff;
    background: var(--app-primary);
}

body.is-kanban-dragging,
body.is-kanban-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

[data-bs-theme="dark"] .kanban-card.priority-medium .kanban-priority {
    background: rgba(37, 99, 235, 0.22);
    color: #93c5fd;
}

[data-bs-theme="dark"] .kanban-card.priority-high .kanban-priority {
    background: rgba(217, 119, 6, 0.22);
    color: #fcd34d;
}

[data-bs-theme="dark"] .kanban-card.priority-urgent .kanban-priority {
    background: rgba(185, 28, 28, 0.28);
    color: #fca5a5;
}

[data-bs-theme="dark"] .kanban-priority {
    background: #1f2937;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .kanban-card.is-overdue {
    background: color-mix(in srgb, #7f1d1d 22%, var(--app-surface));
    border-color: #7f1d1d;
}

[data-bs-theme="dark"] .kanban-card.is-overdue .kanban-due-chip {
    background: rgba(185, 28, 28, 0.35);
    color: #fecaca;
}

[data-bs-theme="dark"] .kanban-card.is-due-soon .kanban-due-chip {
    background: rgba(217, 119, 6, 0.28);
    color: #fde68a;
}

.completed-task-list {
    padding-left: 1.2rem;
    margin: 0;
}

.completed-task-list li {
    margin-bottom: 0.4rem;
}

.completed-task-list a {
    text-decoration: none;
    font-weight: 600;
    margin-right: 0.5rem;
}

.activity-timeline {
    border-left: 2px solid var(--app-border);
    padding-left: 1rem;
    margin: 0 0 1.25rem;
}

.activity-item {
    position: relative;
    padding-bottom: 1rem;
}

.activity-item::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--app-primary);
    position: absolute;
    left: -1.35rem;
    top: 0.35rem;
}

    .report-doc-header {
        border-bottom: 2px solid var(--app-border);
        padding-bottom: 1rem;
        margin-bottom: 1.25rem;
    }

    .report-doc-brand,
    .report-doc-header .report-doc-brand {
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        font-size: 0.78rem;
        color: var(--app-muted);
    }

    .report-doc-header h1,
    .report-print-masthead h1 {
        font-size: 1.7rem;
        margin: 0.2rem 0 0.35rem;
    }

    .report-doc-meta,
    .report-doc-filters {
        color: var(--app-muted);
        margin-bottom: 0.35rem;
    }

    .report-print-body {
        background: #f4f6f8;
    }

    .report-print-toolbar {
        max-width: 920px;
        margin: 1rem auto;
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
        padding: 0 1rem;
    }

    .report-print-page {
        max-width: 920px;
        margin: 0 auto 2rem;
        background: #fff;
        padding: 2rem 2.25rem 3.5rem;
        box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
        color: #111827;
    }

    .report-print-masthead {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        border-bottom: 3px solid #111827;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .report-print-dates {
        text-align: right;
        font-size: 0.9rem;
        color: #4b5563;
    }

    .report-print-page h2 {
        font-size: 1.05rem;
        margin: 1.5rem 0 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .report-print-table {
        width: 100%;
        font-size: 0.88rem;
    }

    .report-print-table th,
    .report-print-table td {
        padding: 0.45rem 0.5rem;
        border-bottom: 1px solid #e5e7eb;
        vertical-align: top;
    }

    .report-print-table thead th,
    .report-print-table tfoot th {
        background: #f3f4f6;
        font-weight: 600;
    }

    .report-print-table.summary-grid th {
        width: 22%;
        background: #f8fafc;
    }

    .report-print-foot {
        margin-top: 2rem;
        padding-top: 0.75rem;
        border-top: 1px solid #d1d5db;
        color: #6b7280;
        font-size: 0.8rem;
    }

    @media print {
        .no-print,
        .report-print-toolbar,
        .app-topbar,
        .app-sidebar,
        .app-footer,
        .btn,
        form.row,
        .filter-actions,
        .report-filter-card {
            display: none !important;
        }
        .report-print-body {
            background: #fff;
        }
        .report-print-page {
            box-shadow: none;
            max-width: none;
            margin: 0;
            padding: 0 0 18mm;
        }
        .kanban-board {
            display: flex;
            overflow: visible;
        }
        @page {
            size: A4;
            margin: 16mm 14mm 18mm;
        }
        .report-print-foot::after {
            content: 'Page ' counter(page);
        }
    }

@media (max-width: 700px) {
    .report-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

@media (max-width: 991.98px) {
    .kanban-column {
        max-width: 300px;
        flex: 0 0 280px;
    }
}

@media (max-width: 575.98px) {
    .kanban-board {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    .kanban-column {
        scroll-snap-align: start;
        flex: 0 0 85vw;
        max-width: 85vw;
        min-width: 85vw;
    }
}

@media print {
    .app-topbar,
    .app-sidebar,
    .app-footer,
    .btn,
    form.row,
    .filter-actions {
        display: none !important;
    }
    .kanban-board {
        display: block;
        overflow: visible;
    }
}
