/*
==========================================================
Рабочая область Dashboard
==========================================================
*/

/* ========================================================
   SIDEBAR
======================================================== */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;

    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));

    background: #1e293b;

    overflow-y: auto;

    padding: 20px 12px;

    z-index: 900;

    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 10px;
}


/* ========================================================
   SIDEBAR — список
======================================================== */

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin-bottom: 4px;
}


/* ========================================================
   SIDEBAR — ссылки
======================================================== */

.sidebar a {
    display: flex;

    align-items: center;
    gap: 12px;

    min-height: 46px;

    padding: 11px 14px;

    border-radius: 9px;

    color: #cbd5e1;

    font-size: 14px;
    font-weight: 500;

    text-decoration: none;

    transition:
        background-color .18s ease,
        color .18s ease,
        transform .18s ease;
}

.sidebar a:hover {
    background: #334155;

    color: #ffffff;

    text-decoration: none;

    transform: translateX(2px);
}

.sidebar a.active {
    background: var(--primary);

    color: #ffffff;

    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}


/* ========================================================
   SIDEBAR — иконки
======================================================== */

.sidebar i {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 22px;
    min-width: 22px;

    font-size: 17px;

    opacity: .9;
}

.sidebar a.active i {
    opacity: 1;
}


/* ========================================================
   MAIN CONTENT
======================================================== */

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);

    min-height: calc(100vh - var(--header-height));

    padding: 30px;

    background: #f8fafc;
}


/* ========================================================
   ОБЩИЙ КОНТЕЙНЕР
======================================================== */

.page-container {
    width: 100%;
    max-width: 1600px;

    margin: 0 auto;
}


/* ========================================================
   ЗАГОЛОВОК СТРАНИЦЫ
======================================================== */

.page-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 25px;
}

.page-header-left {
    min-width: 0;
}

.page-header-actions {
    display: flex;

    align-items: center;

    gap: 10px;

    flex-wrap: wrap;
}

.content-title {
    margin: 0;

    color: var(--text);

    font-size: 27px;
    font-weight: 700;

    line-height: 1.2;
}

.content-subtitle {
    margin-top: 7px;

    color: var(--text-light);

    font-size: 14px;
}


/* ========================================================
   CONTENT CARD
======================================================== */

.content-card {
    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: var(--radius);

    padding: 24px;

    box-shadow: var(--shadow);
}

.content-card + .content-card {
    margin-top: 20px;
}


/* ========================================================
   CARD HEADER
======================================================== */

.card-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin-bottom: 20px;

    padding-bottom: 16px;

    border-bottom: 1px solid #eef2f7;
}

.card-title {
    margin: 0;

    color: var(--text);

    font-size: 18px;
    font-weight: 700;
}

.card-description {
    margin-top: 5px;

    color: var(--text-light);

    font-size: 13px;
}


/* ========================================================
   ACTION GRID
======================================================== */

.action-grid {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    flex-wrap: wrap;

    margin-bottom: 20px;
}

.action-grid-left,
.action-grid-right {
    display: flex;

    align-items: center;

    gap: 10px;

    flex-wrap: wrap;
}


/* ========================================================
   СТАТИСТИКА
======================================================== */

.stats-grid {
    display: grid;

    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 25px;
}

.stat-card {
    display: flex;

    align-items: center;

    gap: 15px;

    min-width: 0;

    padding: 20px;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: var(--radius);

    box-shadow: var(--shadow);

    transition:
        transform .18s ease,
        box-shadow .18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);

    box-shadow: 0 8px 25px rgba(15, 23, 42, .08);
}

.stat-icon {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;

    min-width: 46px;

    border-radius: 12px;

    background: #eff6ff;

    color: var(--primary);

    font-size: 19px;
}

.stat-content {
    min-width: 0;
}

.stat-value {
    color: var(--text);

    font-size: 24px;
    font-weight: 700;

    line-height: 1.1;
}

.stat-label {
    margin-top: 5px;

    color: var(--text-light);

    font-size: 13px;
}


/* ========================================================
   ФОРМЫ
======================================================== */

.form-group {
    margin-bottom: 18px;
}

.form-group:last-of-type {
    margin-bottom: 24px;
}

.form-label {
    display: block;

    margin-bottom: 7px;

    color: var(--text);

    font-size: 14px;
    font-weight: 600;
}

.form-help {
    margin-top: 5px;

    color: var(--text-light);

    font-size: 12px;
}

.form-row {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 18px;
}

.form-row-3 {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 18px;
}


/* ========================================================
   INPUT / SELECT / TEXTAREA
======================================================== */

.form-control,
.form-select,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;

    min-height: 42px;

    padding: 10px 12px;

    border: 1px solid #d7dee8;

    border-radius: 8px;

    background: #ffffff;

    color: var(--text);

    font-size: 14px;

    outline: none;

    transition:
        border-color .18s ease,
        box-shadow .18s ease;
}

.form-group textarea {
    min-height: 100px;

    resize: vertical;
}

.form-control:focus,
.form-select:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);

    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}


/* ========================================================
   ТАБЛИЦЫ
======================================================== */

.table-wrapper {
    width: 100%;

    overflow-x: auto;

    border: 1px solid #e5e7eb;

    border-radius: 10px;

    background: #ffffff;
}

.data-table {
    width: 100%;

    border-collapse: collapse;

    min-width: 800px;
}

.data-table th {
    padding: 13px 14px;

    background: #f8fafc;

    border-bottom: 1px solid #e2e8f0;

    color: #475569;

    font-size: 12px;
    font-weight: 700;

    text-align: left;

    white-space: nowrap;
}

.data-table td {
    padding: 14px;

    border-bottom: 1px solid #eef2f7;

    color: var(--text);

    font-size: 14px;

    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color .15s ease;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}


/* ========================================================
   СТАТУСЫ ЗАДАЧ
======================================================== */

.task-row-overdue {
    background: #fff1f2 !important;
}

.task-row-overdue:hover {
    background: #ffe4e6 !important;
}

.task-row-waiting {
    background: #fffaf0 !important;
}

.task-row-waiting:hover {
    background: #fff4d6 !important;
}

.task-row-completed {
    background: #f0fdf4 !important;
}

.task-row-completed:hover {
    background: #dcfce7 !important;
}


/* ========================================================
   BADGES
======================================================== */

.badge {
    display: inline-flex;

    align-items: center;

    min-height: 27px;

    padding: 4px 9px;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
}

.badge-work {
    background: #dbeafe;

    color: #1d4ed8;
}

.badge-waiting {
    background: #ffedd5;

    color: #c2410c;
}

.badge-completed {
    background: #dcfce7;

    color: #15803d;
}

.badge-overdue {
    background: #fee2e2;

    color: #b91c1c;
}


/* ========================================================
   КНОПКИ
======================================================== */

.btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 7px;

    min-height: 40px;

    padding: 9px 15px;

    border: 1px solid transparent;

    border-radius: 8px;

    font-size: 14px;
    font-weight: 600;

    text-decoration: none;

    cursor: pointer;

    transition:
        background-color .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        transform .15s ease;
}

.btn:hover {
    text-decoration: none;

    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);

    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);

    color: #ffffff;
}

.btn-secondary {
    background: #f1f5f9;

    border-color: #e2e8f0;

    color: #334155;
}

.btn-secondary:hover {
    background: #e2e8f0;

    color: #1e293b;
}

.btn-danger {
    background: #dc2626;

    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;

    color: #ffffff;
}

.btn-success {
    background: #16a34a;

    color: #ffffff;
}

.btn-success:hover {
    background: #15803d;

    color: #ffffff;
}

.btn-warning {
    background: #f59e0b;

    color: #ffffff;
}

.btn-warning:hover {
    background: #d97706;

    color: #ffffff;
}

.btn-sm {
    min-height: 34px;

    padding: 7px 11px;

    font-size: 13px;
}


/* ========================================================
   ПУСТОЕ СОСТОЯНИЕ
======================================================== */

.empty-state {
    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    padding: 55px 25px;

    color: var(--text-light);

    text-align: center;
}

.empty-state i {
    margin-bottom: 12px;

    font-size: 38px;

    opacity: .5;
}

.empty-state-title {
    margin-bottom: 5px;

    color: var(--text);

    font-size: 16px;
    font-weight: 600;
}

.empty-state-text {
    font-size: 13px;
}


/* ========================================================
   ALERT
======================================================== */

.alert {
    display: flex;

    align-items: flex-start;

    gap: 10px;

    padding: 13px 15px;

    margin-bottom: 20px;

    border-radius: 9px;

    font-size: 14px;
}

.alert-success {
    background: #f0fdf4;

    border: 1px solid #bbf7d0;

    color: #166534;
}

.alert-danger {
    background: #fef2f2;

    border: 1px solid #fecaca;

    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;

    border: 1px solid #fde68a;

    color: #92400e;
}

.alert-info {
    display: flex;
    flex-direction: column;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}


/* ========================================================
   МОДАЛЬНЫЕ ОКНА
======================================================== */

.modal-content {
    border: none;

    border-radius: 14px;

    box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
}

.modal-header {
    padding: 18px 22px;

    border-bottom: 1px solid #eef2f7;
}

.modal-title {
    font-size: 18px;

    font-weight: 700;
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    padding: 16px 22px;

    border-top: 1px solid #eef2f7;
}


/* ========================================================
   РАЗДЕЛИТЕЛЬ
======================================================== */

.section-divider {
    height: 1px;

    margin: 25px 0;

    background: #e5e7eb;
}


/* ========================================================
   ССЫЛКИ
======================================================== */

.document-link {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    max-width: 260px;

    color: var(--primary);

    font-size: 13px;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.document-link:hover {
    color: var(--primary-hover);
}


/* ========================================================
   УЧАСТИЕ В ПРОЕКТЕ
======================================================== */

.participation-text {
    min-width: 180px;

    max-width: 450px;

    line-height: 1.5;

    color: #475569;
}

.approval-check {
    display: inline-flex;

    align-items: center;

    gap: 7px;

    cursor: pointer;

    font-size: 13px;
    font-weight: 600;
}

.approval-check input {
    width: 17px;
    height: 17px;

    cursor: pointer;
}


/* ========================================================
   АДАПТИВНОСТЬ
======================================================== */

@media (max-width: 1100px) {

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-row-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 850px) {

    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;

        padding: 22px;
    }

    .page-header {
        align-items: flex-start;

        flex-direction: column;
    }

}


@media (max-width: 700px) {

    .sidebar {
        position: static;

        width: 100%;
        height: auto;

        padding: 10px;
    }

    .sidebar ul {
        display: flex;

        gap: 5px;

        overflow-x: auto;
    }

    .sidebar li {
        flex: 0 0 auto;

        margin-bottom: 0;
    }

    .sidebar a {
        padding: 10px 12px;
    }

    .main-content {
        margin-left: 0;
        margin-top: var(--header-height);

        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .content-card {
        padding: 17px;
    }

    .content-title {
        font-size: 23px;
    }

    .action-grid {
        align-items: stretch;

        flex-direction: column;
    }

    .action-grid-left,
    .action-grid-right {
        width: 100%;
    }

    .btn {
        min-height: 42px;
    }

}


@media (max-width: 480px) {

    .main-content {
        padding: 12px;
    }

    .content-card {
        border-radius: 10px;

        padding: 14px;
    }

    .page-header {
        margin-bottom: 18px;
    }

    .content-title {
        font-size: 21px;
    }

}