* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: #f5f7fa;
    color: #16273a;
}


/* Верхняя панель */

.topbar {
    height: 64px;
    background: #002a63;
    color: white;
}

.topbar-inner {
    max-width: 1200px;
    height: 64px;
    margin: 0 auto;
    padding: 0 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 22px;
    font-weight: 700;
}

.topbar nav {
    display: flex;
    gap: 24px;
}

.topbar nav a {
    color: white;
    text-decoration: none;
    opacity: 0.9;
}

.topbar nav a:hover {
    opacity: 1;
}


/* Авторизация */

.login-page {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;

    background: white;
    padding: 42px;

    border-radius: 14px;

    box-shadow:
        0 10px 35px rgba(0, 42, 99, 0.10);
}

.login-logo {
    font-size: 32px;
    font-weight: 700;

    color: #002a63;

    margin-bottom: 8px;
}

.login-subtitle {
    color: #68798c;
    margin-bottom: 32px;
}


/* Формы */

.form-panel {
    padding: 32px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;

    font-size: 14px;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select,
.comment-form textarea,
.status-select {
    width: 100%;

    border: 1px solid #d5dde6;
    border-radius: 8px;

    padding: 10px 12px;

    font-family: inherit;
    font-size: 16px;

    background: white;
    color: #16273a;

    outline: none;
}

.form-group input,
.form-group select {
    min-height: 44px;
}

.form-group textarea,
.comment-form textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.comment-form textarea:focus,
.status-select:focus {
    border-color: #27b2e8;

    box-shadow:
        0 0 0 3px rgba(39, 178, 232, 0.12);
}

.form-row {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;
}

.form-actions,
.header-actions {
    display: flex;
    gap: 12px;
}


/* Кнопки */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;

    padding: 0 18px;

    border: none;
    border-radius: 8px;

    font-size: 15px;
    font-weight: 600;

    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    background: #27b2e8;
    color: white;
}

.button-primary:hover {
    filter: brightness(0.96);
}

.button-secondary {
    background: #e8edf3;
    color: #16273a;
}

.button-secondary:hover {
    background: #dde5ed;
}

.login-card .button {
    width: 100%;
}


/* Сообщения */

.alert {
    padding: 12px 14px;
    margin-bottom: 20px;

    border-radius: 8px;
}

.alert-error {
    background: #fff0f0;
    color: #a82828;
}


/* Основной интерфейс */

.page-container {
    max-width: 1200px;

    margin: 0 auto;
    padding: 36px 24px;
}

.page-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 28px;
}

.page-header h1 {
    margin: 0 0 6px 0;
    font-size: 30px;
}

.page-description {
    margin: 0;
    color: #68798c;
}

.panel {
    background: white;

    border-radius: 12px;

    box-shadow:
        0 4px 20px rgba(0, 42, 99, 0.06);
}

.empty-state {
    padding: 80px 24px;
    text-align: center;
}

.empty-state h2 {
    margin: 0 0 10px 0;
}

.empty-state p {
    margin: 0;
    color: #68798c;
}


/* Список задач */

.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-card {
    display: flex;

    justify-content: space-between;

    gap: 24px;

    padding: 22px 24px;

    background: white;
    border-radius: 12px;

    box-shadow:
        0 3px 15px rgba(0, 42, 99, 0.06);
}

.task-card-link {
    color: inherit;
    text-decoration: none;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.task-card-link:hover {
    transform: translateY(-2px);

    box-shadow:
        0 8px 24px rgba(0, 42, 99, 0.11);
}

.task-main {
    flex: 1;
    min-width: 0;
}

.task-title-row {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-bottom: 8px;
}

.task-number {
    color: #8998a8;

    font-size: 14px;
    font-weight: 600;
}

.task-title {
    font-size: 18px;
    font-weight: 700;
}

.task-description {
    margin-bottom: 15px;

    color: #526579;
    line-height: 1.5;

    white-space: pre-wrap;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 10px 22px;

    color: #718195;
    font-size: 13px;
}

.task-meta strong {
    color: #425569;
}

.task-badges {
    display: flex;
    align-items: flex-start;

    gap: 8px;
    flex-wrap: wrap;
}


/* Метки */

.badge {
    display: inline-flex;
    align-items: center;

    min-height: 28px;

    padding: 0 10px;

    border-radius: 20px;

    font-size: 12px;
    font-weight: 700;

    white-space: nowrap;
}

.status-new {
    background: #eef2f6;
    color: #526579;
}

.status-assigned {
    background: #e8f6fc;
    color: #11789f;
}

.status-in_progress {
    background: #e8f0ff;
    color: #2457a6;
}

.status-waiting {
    background: #fff5db;
    color: #8b6500;
}

.status-done {
    background: #e8f7ed;
    color: #267943;
}

.priority-low {
    background: #f0f2f4;
    color: #68798c;
}

.priority-normal {
    background: #edf3ff;
    color: #41679b;
}

.priority-high {
    background: #fff1df;
    color: #a65a00;
}

.priority-urgent {
    background: #ffe8e8;
    color: #b52d2d;
}


/* Карточка задачи */

.task-detail-number {
    color: #68798c;

    font-size: 14px;
    font-weight: 600;

    margin-bottom: 5px;
}

.task-detail-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr) 320px;

    gap: 20px;

    align-items: start;
}

.task-detail-main {
    padding: 30px;

    min-height: 240px;
}

.task-detail-sidebar {
    padding: 26px;
}

.detail-section h2,
.comments-panel h2,
.history-panel h2 {
    margin: 0 0 20px 0;

    font-size: 20px;
}

.detail-description {
    color: #425569;

    font-size: 16px;
    line-height: 1.65;

    white-space: pre-wrap;
}

.detail-empty {
    color: #8998a8;
}

.detail-field {
    padding-bottom: 20px;
    margin-bottom: 20px;

    border-bottom: 1px solid #edf1f5;
}

.detail-field:last-child {
    margin-bottom: 0;
    padding-bottom: 0;

    border-bottom: none;
}

.detail-label {
    color: #7b8a9a;

    font-size: 12px;
    font-weight: 600;

    margin-bottom: 7px;

    text-transform: uppercase;
}

.detail-value {
    font-size: 15px;
    font-weight: 600;
}

.completed-value {
    color: #267943;
}

.status-select {
    min-height: 42px;
}


/* Комментарии */

.comments-panel {
    margin-top: 20px;

    padding: 30px;
}

.comments-list {
    display: flex;
    flex-direction: column;

    gap: 14px;

    margin-bottom: 26px;
}

.comment {
    padding: 16px 18px;

    background: #f7f9fb;

    border-radius: 10px;
}

.comment-header {
    display: flex;
    justify-content: space-between;

    gap: 15px;

    margin-bottom: 9px;
}

.comment-header strong {
    font-size: 14px;
}

.comment-header span {
    color: #8998a8;
    font-size: 12px;
}

.comment-body {
    color: #425569;

    line-height: 1.55;

    white-space: pre-wrap;
}

.comment-form {
    margin-top: 22px;
}

.comment-form textarea {
    margin-bottom: 12px;
}


/* История */

.history-panel {
    margin-top: 20px;

    padding: 30px;
}

.history-list {
    display: flex;
    flex-direction: column;

    gap: 0;
}

.history-item {
    position: relative;

    display: flex;

    gap: 14px;

    padding-bottom: 20px;
}

.history-item:not(:last-child)::before {
    content: "";

    position: absolute;

    left: 5px;
    top: 15px;
    bottom: 0;

    width: 1px;

    background: #dbe3eb;
}

.history-dot {
    position: relative;
    z-index: 1;

    flex: 0 0 11px;

    width: 11px;
    height: 11px;

    margin-top: 5px;

    background: #27b2e8;

    border-radius: 50%;
}

.history-content {
    flex: 1;
}

.history-text {
    color: #425569;

    font-size: 14px;
    line-height: 1.5;
}

.history-time {
    color: #8998a8;

    font-size: 12px;

    margin-top: 4px;
}


/* Адаптивность */

@media (max-width: 800px) {

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

}

@media (max-width: 700px) {

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .task-card {
        flex-direction: column;
    }

    .task-badges {
        justify-content: flex-start;
    }

    .comment-header {
        flex-direction: column;
        gap: 4px;
    }

}


/* Просроченные задачи */

.due-overdue {
    color: #b42318;
    font-weight: 700;
}

.overdue-label {
    display: inline-flex;

    margin-left: 8px;
    padding: 3px 8px;

    border-radius: 12px;

    background: #ffe8e8;
    color: #b42318;

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
}


/* Цветовое отображение текущего статуса */

.status-select-new {
    background: #f1f3f5;
    color: #526579;
}

.status-select-assigned {
    background: #e8f6fc;
    color: #11789f;
}

.status-select-in_progress {
    background: #e8f0ff;
    color: #2457a6;
}

.status-select-waiting {
    background: #fff5db;
    color: #8b6500;
}

.status-select-done {
    background: #e8f7ed;
    color: #267943;
}


/* =========================================================
   AlTask semantic colors v1
   ========================================================= */

.status-assigned {
    background: #eefaff;
    color: #2583a6;
}

.status-in_progress {
    background: #e1ebff;
    color: #174ea6;
}

.priority-urgent {
    background: #f1e8ff;
    color: #7137b8;
}

.priority-select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d5dde6;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.priority-select-low {
    background: #f1f3f5;
    color: #68798c;
}

.priority-select-normal {
    background: #edf3ff;
    color: #41679b;
}

.priority-select-high {
    background: #fff1df;
    color: #a65a00;
}

.priority-select-urgent {
    background: #f1e8ff;
    color: #7137b8;
}

.task-card-overdue {
    border-left: 5px solid #d92d20;
    box-shadow: 0 4px 20px rgba(217, 45, 32, 0.10);
}

.task-card-overdue:hover {
    box-shadow: 0 8px 28px rgba(217, 45, 32, 0.16);
}

.task-due-overdue {
    color: #b42318;
}

.task-overdue-text {
    display: inline-flex;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 10px;
    background: #ffe8e8;
    color: #b42318;
    font-size: 10px;
    font-weight: 800;
}

.task-card-urgent:not(.task-card-overdue) {
    border-left: 5px solid #8b5cf6;
}

.task-card-done {
    opacity: 0.72;
}

.task-card-done:hover {
    opacity: 1;
}

.task-card-overdue.task-card-urgent {
    border-left-color: #d92d20;
}
