/* ---------- RESET ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f8fafc;
    color: #0f172a;
    line-height: 1.5;
    padding: 16px;
    font-size: 16px;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    box-shadow: 0 4px 6px -2px rgba(0,0,0,0.05), 0 10px 15px -3px rgba(0,0,0,0.1);
    overflow: hidden;
    padding: 20px;
}

@media (min-width: 768px) {
    body {
        padding: 32px;
    }
    .container {
        padding: 32px;
    }
}

h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #0f3b2c;
    border-left: 4px solid #0f3b2c;
    padding-left: 1rem;
    word-break: break-word;
}

h2 {
    font-size: 1.4rem;
    font-weight: 500;
    margin: 1.2rem 0 1rem;
    color: #1e293b;
}

/* Поля ввода */
input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1rem;
    background: #fff;
    margin-bottom: 16px;
}

input:focus {
    outline: none;
    border-color: #0f3b2c;
    box-shadow: 0 0 0 3px rgba(15,59,44,0.1);
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #334155;
}

/* КНОПКИ – базовые */
button, .button {
    background: #0f3b2c;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-block;
    text-align: center;
    width: auto;
    min-width: 120px;
}

/* Увеличиваем отступ сверху для кнопок внутри любых форм */
form button, form .button {
    margin-top: 20px !important; /* принудительный отступ */
}

/* На мобильных кнопки занимают всю ширину */
@media (max-width: 640px) {
    button, .button {
        width: 100%;
        padding: 14px;
        font-size: 1.1rem;
    }
    form button, form .button {
        margin-top: 20px !important;
    }
}

button:hover, .button:hover {
    background: #1f5e48;
}

/* Таблицы с карточками на мобильных */
@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: visible;
        border: none;
    }
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead {
        display: none;
    }
    tr {
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        margin-bottom: 16px;
        padding: 12px;
        background: white;
    }
    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #e2e8f0;
        gap: 16px;
    }
    td:last-child {
        border-bottom: none;
    }
    td:before {
        content: attr(data-label);
        font-weight: 600;
        width: 40%;
        color: #0f3b2c;
    }
    td .table-actions {
        justify-content: flex-end;
        width: 100%;
    }
}

@media (min-width: 769px) {
    .table-wrapper {
        overflow-x: auto;
        margin: 1rem 0;
        border-radius: 16px;
        border: 1px solid #e2e8f0;
    }
    table {
        width: 100%;
        border-collapse: collapse;
        min-width: 500px;
    }
    th, td {
        text-align: left;
        padding: 12px;
        border-bottom: 1px solid #e2e8f0;
    }
    th {
        background: #f1f5f9;
        font-weight: 600;
    }
}

.table-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.table-actions a {
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 24px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.error, .success {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.error {
    background: #fee2e2;
    color: #b91c1c;
    border-left: 4px solid #b91c1c;
}
.success {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #166534;
}

a {
    color: #0f3b2c;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

form {
    margin-bottom: 24px;
}

/* Подвал */
footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
}