
:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --panel-surface: rgba(255, 255, 255, 0.94);
    --surface-soft: #f8fbff;
    --surface-strong: #eef3fb;
    --border: #dde5f0;
    --border-strong: #ccd8e7;
    --text: #18212f;
    --muted: #617086;
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-soft: #eef0ff;
    --accent: #0ea5e9;
    --success-soft: #e9f9ef;
    --success-text: #127a41;
    --warning-soft: #fff4db;
    --warning-text: #986300;
    --danger-soft: #ffe7e6;
    --danger-text: #b23a32;
    --neutral-soft: #edf1f6;
    --neutral-text: #4a5568;
    --card-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    --card-shadow-hover: 0 24px 60px rgba(15, 23, 42, 0.12);
    --site-navbar-height: 74px;
    --calendar-sticky-offset: calc(var(--site-navbar-height) - 12px);
}

html {
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: var(--site-navbar-height) 0 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.10), transparent 28%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.10), transparent 26%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 28%, #f3f6fb 100%);
    background-attachment: fixed;
}

body, .form-control, .form-select, .btn, .table, .badge {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--primary);
}

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

main.container {
    scroll-padding-top: calc(var(--calendar-sticky-offset) + 1rem);
}

.site-navbar {
    position: fixed;
    left: 0;
    right: 0;
    margin-top: 0;
    margin-bottom: 0;
    top: 0;
    min-height: var(--site-navbar-height);
    z-index: 1030;
    background: linear-gradient(135deg, rgba(82, 97, 122, 0.96) 0%, rgba(92, 108, 134, 0.95) 52%, rgba(103, 119, 145, 0.94) 100%);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 30px rgba(50, 61, 78, 0.16);
}

.navbar-brand {
    text-decoration: none;
    padding-block: 0.2rem;
}

.navbar-brand span {
    line-height: 1;
}


.brand-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.012em;
}

.header-actions .btn {
    min-height: 40px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-primary-actions,
.header-secondary-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.header-mobile-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin-left: auto;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.header-mobile-toggle-btn:hover,
.header-mobile-toggle-btn:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
}

.header-mobile-toggle-icon {
    display: inline-block;
    font-size: 1.35rem;
    line-height: 1;
    transition: transform 0.25s ease;
}

.site-navbar.is-mobile-expanded .header-mobile-toggle-icon {
    transform: rotate(180deg);
}

.btn-sm {
    min-height: 40px;
    padding: 0 0.95rem;
    line-height: 1;
}

.app-main {
    position: relative;
}

.page-shell,
.form-shell,
.analytics-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.page-hero,
.panel-card,
.card {
    border: 1px solid rgba(221, 229, 240, 0.8) !important;
    border-radius: 24px !important;
    background: var(--panel-surface);
    box-shadow: var(--card-shadow);
}

.page-hero {
    padding: 1.5rem 1.75rem;
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(14, 165, 233, 0.08)),
        rgba(255, 255, 255, 0.94);
}

.page-hero-title {
    margin: 0;
    font-size: clamp(1.75rem, 2.4vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-hero-text {
    color: var(--muted);
    max-width: 780px;
    margin: 0.4rem 0 0;
}

.page-hero-compact {
    padding: 1.1rem 1.35rem;
}

.page-hero-compact .page-hero-title {
    font-size: clamp(1.55rem, 2vw, 1.95rem);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.section-subtitle,
.text-secondary,
.form-text,
.small.text-secondary {
    color: var(--muted) !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: 14px;
    font-weight: 600;
    line-height: 1;
    padding: 0 1.1rem;
    min-height: 48px;
    border-width: 1px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background-color: var(--primary) !important;
    background-image: none !important;
    border-color: var(--primary) !important;
    box-shadow: 0 14px 28px rgba(79, 70, 229, 0.24);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--primary-dark) !important;
    background-image: none !important;
    border-color: var(--primary-dark) !important;
    box-shadow: 0 18px 34px rgba(79, 70, 229, 0.28) !important;
}

.btn-soft,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-light {
    background: rgba(255, 255, 255, 0.88);
    border-color: var(--border);
    color: var(--text);
}

.btn-soft:hover,
.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-light:hover,
.btn-outline-primary.active {
    background: var(--primary-soft) !important;
    border-color: rgba(79, 70, 229, 0.24) !important;
    color: var(--primary-dark) !important;
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.12);
}

.btn-logout-soft {
    background: linear-gradient(135deg, rgba(255, 226, 224, 0.96) 0%, rgba(255, 214, 212, 0.94) 100%) !important;
    border-color: rgba(212, 126, 121, 0.52) !important;
    color: #8e3b37 !important;
    box-shadow: 0 10px 20px rgba(186, 95, 90, 0.15);
}

.btn-logout-soft:hover,
.btn-logout-soft:focus,
.btn-logout-soft:active {
    background: linear-gradient(135deg, rgba(255, 214, 212, 0.98) 0%, rgba(252, 198, 195, 0.96) 100%) !important;
    border-color: rgba(199, 103, 97, 0.58) !important;
    color: #7b302c !important;
    box-shadow: 0 12px 24px rgba(199, 103, 97, 0.22);
}

.btn-group {
    background: rgba(255, 255, 255, 0.75);
    padding: 0.25rem;
    border: 1px solid rgba(221, 229, 240, 0.9);
    border-radius: 16px;
}

.card .card-body {
    padding: 1.5rem;
}

.table-responsive {
    border-radius: 22px;
}

.tasks-list-card {
    background: var(--panel-surface) !important;
    overflow: hidden;
}

.tasks-list-card > .card-body,
.tasks-list-card .table-responsive,
.tasks-list-card .tasks-list-table {
    background: transparent !important;
}

.tasks-list-card .tasks-list-table.table-hover tbody tr:hover > * {
    background: rgba(79, 70, 229, 0.035) !important;
}

.tasks-list-card .table-responsive {
    background: transparent;
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 1rem 1.1rem;
    border-color: rgba(221, 229, 240, 0.72);
}

.table thead th {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #526074;
    background: linear-gradient(180deg, #f9fbfe 0%, #f1f5fb 100%) !important;
}


.table-sort-link {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-decoration: none;
    color: inherit;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.table-sort-link:hover {
    color: var(--primary-dark);
}

.task-mobile-sortbar {
    display: none;
}

.table-sort-indicator {
    font-size: 0.92em;
    line-height: 1;
    opacity: 0.55;
}

.table-sort-asc,
.table-sort-desc {
    color: var(--primary-dark);
}

.table-sort-asc .table-sort-indicator,
.table-sort-desc .table-sort-indicator {
    opacity: 1;
}

.tasks-list-table tbody td {
    text-align: center !important;
    vertical-align: middle;
}

.tasks-list-table tbody td > * {
    text-align: center;
}

.tasks-list-table tbody td .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-inline: auto;
}

.task-mobile-toggle {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
}

.task-mobile-title,
.task-mobile-description {
    display: block;
}

.table-hover tbody tr:hover > * {
    background: rgba(79, 70, 229, 0.035);
}

.form-control,
.form-select,
.form-check {
    border-color: var(--border);
}

.form-control,
.form-select {
    border-radius: 14px;
    min-height: 48px;
    padding: 0.75rem 0.95rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

textarea.form-control {
    min-height: 140px;
    resize: vertical;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: rgba(79, 70, 229, 0.36);
    box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.12);
}

.form-label {
    color: var(--text);
    font-weight: 600;
    margin-bottom: 0.45rem;
}

.alert {
    border-radius: 18px;
}

.badge {
    padding: 0.55rem 0.8rem;
    border-radius: 999px !important;
    font-weight: 600;
}

.badge-soft {
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
}

.status-badge,
.task-type-badge {
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.task-type-badge {
    background: var(--surface-soft);
    color: #405166;
    border-color: var(--border);
}

.status-badge-new {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-color: rgba(79, 70, 229, 0.18);
}

.status-badge-progress {
    background: var(--warning-soft);
    color: var(--warning-text);
    border-color: rgba(234, 179, 8, 0.18);
}

.status-badge-done {
    background: var(--success-soft);
    color: var(--success-text);
    border-color: rgba(34, 197, 94, 0.18);
}

.status-badge-cancelled {
    background: var(--neutral-soft);
    color: var(--neutral-text);
    border-color: rgba(100, 116, 139, 0.18);
}

.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card .card-body {
    min-height: 168px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    text-align: center;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.metric-card-warning::before {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.metric-label {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.metric-value {
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    margin: 0;
}

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

.chart-box-trend {
    height: 430px;
}

.chart-box-pie {
    height: 350px;
}

.chart-box-short {
    height: 315px;
}

.chart-box-medium {
    height: 340px;
}

.chart-box-large {
    height: 360px;
}

.chart-box-result {
    height: 360px;
}

canvas {
    width: 100% !important;
    height: 100% !important;
}

.analytics-filter-card {
    top: 5.8rem;
    background: rgba(255, 255, 255, 0.96);
}

.analytics-summary-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}


.analytics-group-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(221, 229, 240, 0.95);
    border-radius: 18px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.analytics-group-tab {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.96rem;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.analytics-group-tab:hover {
    color: var(--primary-dark);
    background: rgba(79, 70, 229, 0.08);
}

.analytics-group-tab.is-active {
    color: var(--primary-dark);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(14, 165, 233, 0.14));
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.12);
}

.analytics-panel {
    display: block;
}

.analytics-panel.d-none {
    display: none !important;
}

.analytics-summary-badges .badge {
    display: inline-flex;
    align-items: center;
    min-height: 2.9rem;
    padding: 0.78rem 1rem;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(221, 229, 240, 0.95);
    color: #415165;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.task-type-dropdown {
    position: relative;
}

.task-type-dropdown summary,
.analytics-choice-dropdown summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    gap: 0.75rem;
    color: var(--text);
    font-weight: 600;
    background-image: none;
    padding-right: 0.95rem;
}

.task-type-dropdown summary::-webkit-details-marker,
.analytics-choice-dropdown summary::-webkit-details-marker {
    display: none;
}

.task-type-dropdown summary::after,
.analytics-choice-dropdown summary::after {
    content: "";
    width: 0.58rem;
    height: 0.58rem;
    flex: 0 0 auto;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.task-type-dropdown[open] summary::after,
.analytics-choice-dropdown[open] summary::after {
    border-color: var(--primary);
    transform: rotate(225deg) translateY(-2px);
}

.task-type-dropdown-menu {
    position: relative;
    z-index: 20;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid rgba(221, 229, 240, 0.92);
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.96) !important;
}

.analytics-choice-dropdown-menu {
    max-height: 280px;
}

.form-check {
    margin-top: 0.15rem;
    background: rgba(248, 251, 255, 0.72);
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.form-check:hover {
    border-color: rgba(79, 70, 229, 0.2);
    background: rgba(79, 70, 229, 0.05);
}

.analytics-option {
    display: flex;
    align-items: center;
    min-height: 46px;
    cursor: pointer;
}

.analytics-option:has(.form-check-input:checked) {
    border-color: rgba(79, 70, 229, 0.32) !important;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(14, 165, 233, 0.1));
    color: var(--primary-dark);
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.08);
}

.analytics-option .form-check-input {
    flex: 0 0 auto;
}

.analytics-option .form-check-label {
    font-weight: 600;
}

.calendar-shell {
    position: relative;
    border-radius: 22px;
    overflow: visible;
}

.calendar-scroll {
    overflow: visible;
}

.calendar-content {
    min-width: 920px;
}

.calendar-header-sticky {
    position: sticky;
    top: var(--calendar-sticky-offset);
    z-index: 25;
    margin-bottom: -1px;
    background: linear-gradient(180deg, rgba(249, 251, 254, 0.985) 0%, rgba(241, 245, 251, 0.985) 100%);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    overflow: hidden;
}

.calendar-grid-wrapper {
    position: relative;
    z-index: 1;
    border-bottom-left-radius: 22px;
    border-bottom-right-radius: 22px;
    overflow: hidden;
}

.calendar-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.calendar-col-time {
    width: 92px;
}

.calendar-table-header th {
    background: transparent;
    border-bottom: 1px solid var(--border);
    text-align: center;
    box-shadow: inset 0 -1px 0 var(--border);
    color: #415166;
    white-space: nowrap;
}

.calendar-day-label {
    font-weight: 700;
}

.calendar-day-date {
    margin-top: 0.1rem;
}

.calendar-time-col {
    width: 92px;
    min-width: 92px;
    background: linear-gradient(180deg, #fafcff 0%, #f4f8fe 100%);
    box-shadow: 1px 0 0 var(--border);
    color: #4e5d72;
}

.calendar-table tbody .calendar-time-col {
    position: sticky;
    left: 0;
    z-index: 2;
}

.calendar-table-header .calendar-time-col {
    position: sticky;
    left: 0;
    z-index: 30;
}

.calendar-table tbody tr:first-child td {
    border-top: 0;
}

.calendar-cell {
    min-height: 118px;
    height: 118px;
    vertical-align: top;
    background: rgba(255, 255, 255, 0.82);
}

.calendar-today,
.calendar-today-cell {
    background: rgba(79, 70, 229, 0.07) !important;
}

.calendar-entry {
    border-radius: 16px;
    padding: 0.58rem 0.7rem;
    min-height: 86px;
    color: inherit;
    border: 1px solid rgba(221, 229, 240, 0.9);
    background: rgba(250, 252, 255, 0.95);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.calendar-entry:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.09);
    border-color: rgba(79, 70, 229, 0.18);
}

.calendar-entry-created {
    border-left: 4px solid var(--accent);
}

.calendar-entry-deadline {
    border-left: 4px solid #ef4444;
}

.calendar-entry-time {
    font-size: 0.75rem;
    color: var(--muted);
}

.calendar-entry-title {
    font-size: 0.82rem;
    font-weight: 700;
    margin-top: 0.18rem;
    line-height: 1.2;
    max-height: calc(1.2em * 2);
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-clamp: 2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.calendar-entry-meta {
    font-size: 0.77rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

.helper-card {
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.92) 0%, rgba(255, 255, 255, 0.92) 100%);
}

.empty-state {
    color: var(--muted);
    padding: 3rem 1.5rem !important;
}

.analytics-filter-card .btn-primary {
    box-shadow: none;
}

.analytics-filter-card .btn-primary:hover,
.analytics-filter-card .btn-primary:focus,
.analytics-filter-card .btn-primary:active {
    box-shadow: 0 16px 30px rgba(79, 70, 229, 0.22) !important;
}

@media (max-width: 991.98px) {
    .analytics-group-tabs {
        width: 100%;
    }

    .analytics-group-tab {
        flex: 1 1 calc(33.333% - 0.35rem);
        text-align: center;
        padding-inline: 0.75rem;
    }

    :root {
        --site-navbar-height: 82px;
        --calendar-sticky-offset: calc(var(--site-navbar-height) - 10px);
    }

    .header-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        margin-top: 0.75rem;
    }

    .header-primary-actions,
    .header-secondary-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .header-primary-actions .btn,
    .header-secondary-actions .btn,
    .header-secondary-actions .header-user-chip {
        width: 100%;
    }

    .header-secondary-actions .header-logout-form {
        width: 100%;
        margin: 0;
    }

    .analytics-filter-card {
        top: 0;
    }
}

@media (max-width: 767.98px) {
    body {
        padding-top: 9.5rem;
    }

    .page-shell {
        margin-top: -0.9rem;
    }

    .page-shell > .page-hero,
    .analytics-shell > .page-hero {
        background:
            linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(14, 165, 233, 0.08)),
            rgba(255, 255, 255, 0.94);
        border: 1px solid rgba(221, 229, 240, 0.8) !important;
        box-shadow: var(--card-shadow);
    }

    .page-shell .page-hero .btn-group {
        background: rgba(255, 255, 255, 0.78);
        border-color: rgba(221, 229, 240, 0.95);
    }

    .page-shell .page-hero .btn-group .btn {
        background: transparent;
        border-color: transparent;
        color: var(--text);
        box-shadow: none;
    }

    .page-shell .page-hero .btn-group .btn.active,
    .page-shell .page-hero .btn-group .btn:active {
        background: rgba(79, 70, 229, 0.12) !important;
        border-color: rgba(79, 70, 229, 0.2) !important;
        color: var(--primary-dark) !important;
        box-shadow: none !important;
    }

    .brand-subtitle {
        display: none !important;
    }

    .page-hero {
        padding: 1.25rem;
    }

    .card .card-body {
        padding: 1.15rem;
    }

    .chart-box-trend {
        height: 360px;
    }

    .chart-box-medium,
    .chart-box-large,
    .chart-box-short {
        height: 280px;
    }
}


.analytics-title-only .page-hero {
    padding-top: 1.35rem;
    padding-bottom: 1.35rem;
}

.analytics-title-only .page-hero-title,
.page-shell .page-hero-title {
    margin-bottom: 0;
}

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

.chart-card-head.compact {
    margin-bottom: 0.75rem;
}

.calendar-shell .calendar-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 22px;
}

.calendar-shell .calendar-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 22px;
}


@media (max-width: 575.98px) {
    .analytics-group-tab {
        flex: 1 1 100%;
    }

    .chart-box-result,
    .chart-box-large,
    .chart-box-medium,
    .chart-box-short,
    .chart-box-trend {
        min-height: 260px;
    }
}

.header-user-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.auth-main {
    min-height: calc(100vh - var(--site-navbar-height) - 2rem);
    display: flex;
    align-items: center;
}

.auth-shell {
    width: min(100%, 1040px);
}

.auth-hero {
    max-width: 760px;
    margin-inline: auto;
}

.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-copy {
    color: var(--muted);
    max-width: 640px;
    margin-inline: auto;
}

.auth-card {
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: transparent;
}

.auth-card-active::before {
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.auth-card-title {
    font-size: 1.25rem;
}

.auth-card-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary-dark);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
}

.auth-alert {
    border-radius: 14px;
    font-size: 0.94rem;
}

.auth-switch {
    color: var(--muted);
    font-size: 0.95rem;
}

.auth-switch a {
    font-weight: 600;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.btn-register {
    background: rgba(79, 70, 229, 0.08);
    border-color: rgba(79, 70, 229, 0.18);
    color: var(--primary-dark);
}

.btn-register:hover,
.btn-register:focus,
.btn-register:active {
    background: rgba(79, 70, 229, 0.14) !important;
    border-color: rgba(79, 70, 229, 0.24) !important;
    color: var(--primary-dark) !important;
}

.auth-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.auth-hint-label {
    font-weight: 600;
}

.auth-hint code {
    padding: 0.35rem 0.55rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
}

@media (max-width: 991.98px) {
    .auth-main {
        display: block;
        min-height: auto;
    }
}

@media (max-width: 991.98px) {
    .site-navbar .container {
        align-items: flex-start;
        row-gap: 0.55rem;
    }

    .header-user-chip {
        justify-content: center;
        text-align: center;
        border-radius: 14px;
        min-height: 44px;
        padding: 0.55rem 0.75rem;
    }

    .btn-sm {
        min-height: 44px;
    }
}

@media (max-width: 767.98px) {
    .tasks-list-card {
        --task-mobile-inline-padding: 0.8rem;
        --task-mobile-row-gap: 0.65rem;
    }

    .site-navbar .container {
        position: relative;
        justify-content: center;
    }

    .site-navbar .navbar-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin-right: 0;
    }

    .site-navbar .brand-title {
        text-align: center;
    }

    .header-mobile-toggle-btn {
        display: inline-flex;
    }

    .header-actions {
        margin-top: 0.35rem;
    }

    .header-secondary-actions {
        margin-top: 0;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
        transform: translateY(-0.35rem);
        transition: max-height 0.28s ease, opacity 0.24s ease, transform 0.24s ease, margin-top 0.24s ease;
    }

    .site-navbar.is-mobile-expanded .header-secondary-actions {
        margin-top: 0.5rem;
        max-height: 5rem;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    main.container {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    .page-hero {
        border-radius: 18px !important;
    }

    .page-shell .page-hero .btn-group {
        width: 100%;
    }

    .page-shell .page-hero .btn-group .btn {
        flex: 1 1 0;
    }

    .page-shell .page-hero .btn-primary {
        width: 100%;
    }

    .form-shell .page-hero .btn {
        width: 100%;
    }

    .task-mobile-sortbar {
        display: block;
        padding: 0.9rem var(--task-mobile-inline-padding) 0.35rem;
        border-bottom: 1px solid rgba(221, 229, 240, 0.72);
        background: rgba(248, 251, 255, 0.78);
        box-sizing: border-box;
    }

    .task-mobile-sortbar-label {
        font-size: 0.76rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--muted);
        margin-bottom: 0.5rem;
    }

    .task-mobile-sortbar-links {
        display: flex;
        gap: 0.4rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    .task-mobile-sortbar-links.task-mobile-sortbar-links-hidden-scrollbar {
        scrollbar-width: none;
    }

    .task-mobile-sortbar-links.task-mobile-sortbar-links-hidden-scrollbar::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    .task-mobile-sort-link {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        text-decoration: none;
        color: #4f5f74;
        font-size: 0.78rem;
        font-weight: 700;
        border: 1px solid rgba(221, 229, 240, 0.95);
        border-radius: 999px;
        padding: 0.38rem 0.68rem;
        background: rgba(255, 255, 255, 0.95);
        white-space: nowrap;
    }

    .task-mobile-sort-link.table-sort-asc,
    .task-mobile-sort-link.table-sort-desc {
        color: var(--primary-dark);
        border-color: rgba(79, 70, 229, 0.26);
        background: rgba(79, 70, 229, 0.09);
    }

    .tasks-list-table thead {
        display: none;
    }

    .tasks-list-table {
        border-collapse: separate;
        border-spacing: 0;
    }

    .tasks-list-table tbody,
    .tasks-list-table tbody tr,
    .tasks-list-table tbody td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .tasks-list-table tbody {
        margin: 0;
        padding: var(--task-mobile-row-gap) var(--task-mobile-inline-padding) 0;
    }

    .tasks-list-table tbody tr {
        padding: 0.8rem;
        border-bottom: 0;
        margin: 0 0 var(--task-mobile-row-gap);
        -webkit-tap-highlight-color: transparent;
    }

    .tasks-list-card .tasks-list-table tbody tr[data-task-row] {
        background: rgba(255, 255, 255, 0.9) !important;
        border: 1px solid rgba(221, 229, 240, 0.9);
        border-radius: 16px;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
    }

    .tasks-list-card .tasks-list-table tbody tr[data-task-row]:last-child {
        margin-bottom: 0;
    }

    .tasks-list-card .tasks-list-table tbody tr[data-task-row] > td {
        background: transparent !important;
    }

    .tasks-list-table,
    .tasks-list-table * {
        -webkit-tap-highlight-color: transparent;
    }

    .tasks-list-table tbody tr:last-child {
        border-bottom: 0;
    }

    .tasks-list-table tbody td {
        display: flex;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 0.8rem;
        text-align: left !important;
        border: 0;
        padding: 0.5rem 0.2rem;
        -webkit-tap-highlight-color: transparent;
    }

    .tasks-list-table tbody td > * {
        min-width: 0;
    }

    .tasks-list-table tbody td:not(:first-child) > * {
        flex: 1 1 auto;
        text-align: center;
    }

    .tasks-list-table tbody td::before {
        content: attr(data-label);
        flex: 0 0 92px;
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .tasks-list-table tbody td:first-child {
        padding-top: 0.2rem;
        display: block;
    }

    .tasks-list-table tbody td:first-child::before {
        content: none;
    }

    .tasks-list-table tbody td:first-child .small.text-secondary {
        margin-top: 0.3rem;
    }

    .task-mobile-summary-cell {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .task-mobile-toggle {
        align-items: flex-start;
        text-align: left;
        position: relative;
        padding-right: 1.5rem;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        -webkit-appearance: none;
        appearance: none;
        user-select: none;
    }

    .task-mobile-toggle:focus,
    .task-mobile-toggle:focus-visible,
    .task-mobile-toggle:active {
        outline: none;
        box-shadow: none;
        background: transparent;
    }

    .task-mobile-toggle:hover,
    .task-mobile-toggle:active {
        background: transparent !important;
    }

    .tasks-list-table.table-hover tbody tr[data-task-row]:hover > *,
    .tasks-list-table tbody tr[data-task-row]:active > *,
    .tasks-list-table tbody tr[data-task-row]:focus-within > * {
        --bs-table-accent-bg: transparent !important;
        background: transparent !important;
        background-color: transparent !important;
        box-shadow: none !important;
    }

    .tasks-list-table.table > :not(caption) > * > * {
        box-shadow: none !important;
    }

    .task-mobile-toggle::after {
        content: "▾";
        position: absolute;
        right: 0;
        top: 0.05rem;
        font-size: 1.35rem;
        color: var(--muted);
        transform: rotate(0deg);
        transition: transform 0.18s ease;
    }

    .tasks-list-table tbody tr.task-mobile-expanded .task-mobile-toggle::after {
        transform: rotate(180deg);
    }

    .tasks-list-table tbody tr[data-task-row]:not(.task-mobile-expanded) td:not(.task-mobile-summary-cell) {
        display: none;
    }

    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td:not(.task-mobile-summary-cell) {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        align-items: center;
        justify-items: center;
        column-gap: 0.8rem;
        text-align: left !important;
    }

    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td:not(.task-mobile-summary-cell)::before {
        grid-column: 1;
        text-align: center;
    }

    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td:not(.task-mobile-summary-cell) > * {
        grid-column: 2;
        justify-self: center;
        width: 100%;
        text-align: center;
    }

    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td[data-label="План, мин"],
    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td[data-label="Факт, мин"] {
        text-align: center !important;
    }

    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td:not(.task-mobile-summary-cell) > .task-type-badge,
    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td:not(.task-mobile-summary-cell) > .status-badge {
        justify-content: center;
    }

    .tasks-list-table tbody td[data-label="Действия"] .btn {
        width: auto;
        flex: 1 1 auto;
    }

    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td:last-child .btn {
        width: auto;
        flex: 1 1 auto;
        margin-inline: 0;
    }

    .tasks-list-table tbody td.empty-state {
        display: block;
        text-align: center !important;
        padding: 2rem 1rem !important;
    }

    .tasks-list-table tbody td.empty-state::before {
        content: none;
    }

    .analytics-summary-badges {
        justify-content: flex-start !important;
    }

    .analytics-summary-badges .badge {
        min-height: 2.4rem;
        padding: 0.55rem 0.75rem;
        font-size: 0.82rem;
    }

    .analytics-group-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .analytics-group-tab {
        flex: 0 0 auto;
        min-width: max-content;
    }

    .chart-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .chart-card-head .text-end {
        text-align: left !important;
    }

    .calendar-toolbar-card .card-body {
        justify-content: center !important;
        text-align: center;
    }

    .calendar-toolbar-meta,
    .calendar-toolbar-actions {
        width: 100%;
        justify-content: center !important;
        text-align: center;
    }

    .calendar-toolbar-actions .btn {
        flex: 1 1 220px;
        max-width: 260px;
    }

    .calendar-shell {
        overflow: hidden;
    }

    .calendar-header-sticky {
        position: static;
        top: auto;
        box-shadow: none;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        overflow: hidden;
    }

    .calendar-grid-wrapper {
        overflow: hidden;
    }

    .calendar-scroll {
        width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .calendar-content {
        min-width: 1090px;
    }

    .calendar-table col:not(.calendar-col-time),
    .calendar-table-header col:not(.calendar-col-time) {
        width: 142px;
    }

    .calendar-table tbody .calendar-time-col,
    .calendar-table-header .calendar-time-col {
        position: static;
    }

    .calendar-cell {
        min-height: 96px;
        height: 96px;
        text-align: center;
    }

    .calendar-time-col {
        font-size: 0.82rem;
        white-space: nowrap;
        padding: 0.5rem 0.35rem !important;
        text-align: center !important;
        vertical-align: middle !important;
    }

    .calendar-table-header .calendar-time-col {
        display: table-cell;
        line-height: 1.2;
        vertical-align: middle !important;
    }

    .calendar-table tbody .calendar-time-col {
        text-align: center !important;
        vertical-align: middle !important;
    }

    .calendar-entry {
        border-radius: 12px;
        padding: 0.45rem 0.5rem;
        min-height: 78px;
        width: 115px;
        min-width: 115px;
        max-width: none;
        margin-left: auto;
        margin-right: auto;
        text-align: left;
    }
}

@media (min-width: 768px) {
    .task-mobile-sortbar {
        display: none !important;
    }

    .tasks-list-table thead {
        display: table-header-group !important;
    }

    .tasks-list-table tbody {
        display: table-row-group !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .tasks-list-table tbody tr {
        display: table-row !important;
        margin: 0 !important;
        padding: 0 !important;
        border-bottom: 0 !important;
    }

    .tasks-list-table tbody td {
        display: table-cell !important;
        width: auto !important;
    }

    .tasks-list-table tbody td::before {
        content: none !important;
    }

    .tasks-list-table tbody tr[data-task-row]:not(.task-mobile-expanded) td:not(.task-mobile-summary-cell),
    .tasks-list-table tbody tr[data-task-row].task-mobile-expanded td:not(.task-mobile-summary-cell) {
        display: table-cell !important;
    }

    .tasks-list-card .tasks-list-table tbody tr[data-task-row] {
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin-bottom: 0 !important;
        background: transparent !important;
    }
}

@media (max-width: 575.98px) {
    .header-primary-actions,
    .header-secondary-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-group-tabs {
        flex-wrap: wrap;
        white-space: normal;
    }

    .analytics-group-tab {
        flex: 1 1 100%;
        min-width: 0;
    }

    .calendar-content {
        min-width: 1090px;
    }

    .calendar-col-time,
    .calendar-time-col {
        width: 76px;
        min-width: 76px;
    }
}
