/* БАЗА */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 10;
    padding: 5;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.4;
    background: #f5f5f5;
    color: #222;
}

/* Обёртка контента */

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.75rem 0.75rem 1.5rem;
    background: #fff;
    min-height: 100vh;
}
.container1 {
    margin: 0 auto;
    padding: 0.75rem 0.75rem 1.5rem;
    background: #fff;
    min-height: 100vh;
}
/* Заголовки / ссылки / текст */

h1, h2, h3 {
    margin: 0 0 0.75rem;
    font-weight: 600;
}

a {
    color: #0066cc;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

p {
    margin: 0 0 0.5rem;
}

/* Формы */

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

input[type="date"],
select,
textarea,
input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 0.5rem 0.6rem;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    margin-top: 0.2rem;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

button,
input[type="submit"] {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    font-size: 1rem;
    border-radius: 4px;
    border: none;
    background: #007bff;
    color: #fff;
    cursor: pointer;
}

button:active,
input[type="submit"]:active {
    transform: translateY(1px);
}

button.secondary {
    background: #6c757d;
}
 
/* Кнопки переключения дат (< Сегодня >) на всю ширину, раскиданы по горизонтали */
.date-buttons {
    display: flex;
    justify-content: space-between; /* < слева, Сегодня по центру, > справа */
    gap: 4px;
    width: 100%;
    margin-top: 0.4rem;
}

.btn-date-nav {
    padding: 0.3rem 0.6rem; /* можно чуть меньше, чем у основных кнопок */
}

/* Отступы между элементами форм */

.form-group {
    margin-bottom: 0.75rem;
}

/* Таблицы (список нарядов) */

.table-wrapper {
    margin-top: 0.5rem;
    background: #fff;
    border-radius: 4px;
    overflow-x: auto; /* горизонтальный скролл на узких экранах */
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* чтобы колонки не схлопывались совсем */
}

th,
td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #ddd;
    font-size: 0.9rem;
    vertical-align: top;
}

th {
    background: #f0f0f0;
    font-weight: 600;
    white-space: nowrap;
}

/* Кнопка "Открыть" в таблице */

table a.btn-small {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 3px;
    background: #007bff;
    color: #fff;
}

/* Блоки-info на карточке работы */

.info-block {
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 0.95rem;
}

/* Мобильная адаптация */

@media (max-width: 600px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 0.5rem 0.5rem 1rem;
    }

    h1 {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
    }

    /* Все кнопки по умолчанию широкие */
    button,
    input[type="submit"] {
        width: 100%;
        margin-top: 0.4rem;
    }

    /* НО кнопки дат — компактные и в одну строку */
    .date-buttons {
        display: inline-flex;
        gap: 4px;
        margin-top: 0.4rem; /* если нужен отступ от поля даты */
    }

    .date-buttons .btn-date-nav {
        width: auto !important;
        margin-top: 0 !important;
        display: inline-block;
    }

    th, td {
        padding: 0.35rem 0.4rem;
        font-size: 0.85rem;
    }

    .top-form {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 0.8rem;
    }
}

/* Статусы в таблице */

td.status-cell {
    font-weight: 600;
    text-align: center;
}

/* план — синий */
td.status-plan {
    background-color: #cce5ff;
    color: #004085;
}

/* в работе — жёлтый */
td.status-inprogress {
    background-color: #fff3cd;
    color: #856404;
}

/* выполнено — зелёный */
td.status-done {
    background-color: #d4edda;
    color: #155724;
}

/* перенесено — красный */
td.status-moved {
    background-color: #f8d7da;
    color: #721c24;
}

/* Фиксированная шапка в прокручиваемой таблице админа */
.table-wrapper-fixed {
    max-height: 80vh;     /* высота блока, дальше — скролл */
    overflow-y: auto;
}

/* Чтобы sticky работал корректно */
.table-wrapper-fixed table {
    border-collapse: collapse;
}

/* Прилипающая шапка */
.table-wrapper-fixed thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Визуал сортировки */
th.sortable {
    cursor: pointer;
    white-space: nowrap;
}

th.sortable::after {
    content: ' ⇅';
    font-size: 0.8em;
    color: #888;
}

th.sortable.sorted-asc::after {
    content: ' ↑';
    color: #000;
}

th.sortable.sorted-desc::after {
    content: ' ↓';
    color: #000;
}


/* Переключатель "Мои / Все" */
.toggle-group {
    display: inline-flex;
    gap: 4px;
}

.toggle-btn {
    padding: 4px 8px;
    font-size: 0.9rem;
    border-radius: 4px;
    border: 1px solid #007bff;
    background: #fff;
    color: #007bff;
    cursor: pointer;
}

.toggle-btn.active {
    background: #007bff;
    color: #fff;
}