:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body { font-family: 'Inter', sans-serif; background-color: var(--bg); color: var(--text-main); margin: 0; padding: 40px 20px; }
.container { max-width: 900px; margin: 0 auto; }

.card { background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); padding: 30px; margin-bottom: 24px; }
h2 { margin-top: 0; font-size: 24px; font-weight: 600; color: #111827; }

.alert { padding: 16px; border-radius: 8px; margin-bottom: 24px; font-weight: 500; display: flex; align-items: center; }
.alert-success { background-color: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background-color: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.form-header { display: flex; gap: 20px; align-items: center; margin-bottom: 30px; background: #f9fafb; padding: 20px; border-radius: 8px; border: 1px solid var(--border); }
.form-header label { font-weight: 600; font-size: 14px; text-transform: uppercase; color: var(--text-secondary); margin-right: 10px; }
select { padding: 10px 14px; border: 1px solid var(--border); border-radius: 6px; background: white; font-size: 15px; outline: none; transition: border-color 0.2s; }
select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

.row-grid { display: grid; grid-template-columns: 2fr 1.5fr 1fr; gap: 15px; margin-bottom: 12px; align-items: center; }
.row-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; display: none; }

/* Заголовки для десктопа */
.grid-header { display: grid; grid-template-columns: 2fr 1.5fr 1fr; gap: 15px; margin-bottom: 10px; padding: 0 10px; }
.grid-header span { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-secondary); }

input[type="number"] { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; box-sizing: border-box; font-size: 15px; }
input[type="number"]:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

/* Custom Select */
.custom-select { position: relative; width: 100%; }
.select-selected { background: white; border: 1px solid var(--border); border-radius: 6px; padding: 10px; cursor: pointer; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; align-items: center; }
.select-selected:after { content: '▼'; font-size: 10px; color: #9ca3af; margin-left: 8px; }
.select-items { position: absolute; background: white; top: 110%; left: 0; right: 0; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); z-index: 50; max-height: 250px; overflow-y: auto; display: none; }
.select-search { padding: 10px; position: sticky; top: 0; background: white; border-bottom: 1px solid var(--border); }
.select-search input { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; box-sizing: border-box; }
.select-item { padding: 10px 14px; cursor: pointer; font-size: 14px; transition: background 0.1s; }
.select-item:hover { background-color: #f3f4f6; }
.show { display: block; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 24px; font-size: 15px; font-weight: 500; border-radius: 6px; border: none; cursor: pointer; transition: all 0.2s; width: 100%; margin-top: 20px; }
.btn-save { background-color: var(--primary); color: white; box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2); }
.btn-save:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-reset { background-color: white; color: var(--danger); border: 1px solid var(--danger); margin-top: 0; width: auto; padding: 10px 20px; font-size: 14px; }
.btn-reset:hover { background-color: #fef2f2; }

.footer-section { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 30px; display: flex; justify-content: space-between; align-items: center; }
.text-small { font-size: 13px; color: var(--text-secondary); }

.error-screen { text-align: center; padding: 50px; color: var(--danger); }

@media (max-width: 600px) {
    .row-grid { grid-template-columns: 1fr; gap: 8px; padding: 15px; background: #f9fafb; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 15px; }
    .grid-header { display: none; }
    .form-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .footer-section { flex-direction: column; gap: 20px; align-items: flex-start; }
    .row-label { display: block; }
}

/* --- Стили для страницы входа --- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 20px;
    color: #111827;
}

.login-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
}

.btn-logout {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.btn-logout:hover {
    background: #fecaca;
}
.header-user {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

