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

body {
    font-family: Arial, sans-serif;
    font-size: 12px;
    background-color: #f0f0f0;
    overflow-x: auto;
}

.main-container {
    display: grid;
    gap: 15px;
    max-width: 100%;   /* чтобы не вылазило */
    box-sizing: border-box;
    overflow-x: hidden; /* запрещаем горизонтальный скролл */
    grid-template-columns: 1fr 1fr 1fr; /* все три равной ширины */
    align-items: stretch;
}

.column {
    background-color: #d0d0d0;
    padding: 8px;
    border-radius: 4px;
    min-height: calc(100vh - 20px);
}

.column-left {
    min-width: 250px;
}

.column-middle {
    min-width: 0; /* важно! чтобы не раздвигало */
    overflow-x: auto; /* если таблица слишком широкая, только она прокручивается */
}

.column-right {
    min-width: 350px;
}

.section-title {
    background-color: #666;
    color: white;
    padding: 4px 8px;
    margin-bottom: 8px;
    font-weight: bold;
    border-radius: 2px;
}

.field-group {
    margin-bottom: 4px;
}

.field-label {
    display: block;
    font-size: 10px;
    margin-bottom: 1px;
    color: #333;
}

input[type="text"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 2px 4px;
    border: 1px solid #999;
    font-size: 11px;
    height: 22px;
    background-color: white;
}

textarea {
    height: 60px;
    resize: vertical;
}

.form-row {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.form-row .field-group {
    flex: 1;
    margin-bottom: 0;
}

.requests-table, .purchases-table, .invoices-table, .financial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    margin-bottom: 8px;
}

.requests-table th, .purchases-table th, .invoices-table th, .financial-table th,
.requests-table td, .purchases-table td, .invoices-table td, .financial-table td {
    border: 1px solid #999;
    padding: 2px;
    text-align: left;
}

.requests-table th, .purchases-table th, .invoices-table th, .financial-table th {
    background-color: #666;
    color: white;
    font-weight: bold;
}

.btn {
    padding: 2px 6px;
    border: 1px solid #999;
    background-color: #e0e0e0;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
}

.btn:hover {
    background-color: #d0d0d0;
}

.btn-primary {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #bd2130;
}

.btn-danger:hover {
    background-color: #bd2130;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border-color: #545b62;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.header-buttons {
    margin-bottom: 10px;
}

.header-buttons .btn {
    margin-right: 4px;
}

.client-type-badge {
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: bold;
}

.type-physical {
    background-color: #28a745;
    color: white;
}

.type-legal {
    background-color: #007bff;
    color: white;
}

.type-ip {
    background-color: #ffc107;
    color: black;
}

.status-badge {
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: bold;
}

.status-completed {
    background-color: #28a745;
    color: white;
}

.status-pending {
    background-color: #ffc107;
    color: black;
}

.status-active {
    background-color: #17a2b8;
    color: white;
}

.money-display {
    text-align: right;
    font-family: monospace;
}

.money-rub {
    color: #28a745;
}

.money-usd {
    color: #007bff;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.checkbox-container input[type="checkbox"] {
    width: auto;
    height: auto;
}

.no-data {
    font-style: italic;
    color: #666;
    text-align: center;
    padding: 10px;
}

.action-buttons {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.compact-table {
    font-size: 9px;
}

.compact-table th, .compact-table td {
    padding: 1px 2px;
}

.form-section {
    border-top: 1px solid #999;
    padding-top: 8px;
    margin-top: 8px;
}

.form-section h4 {
    font-size: 11px;
    margin-bottom: 6px;
    color: #333;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 4px 8px;
    border-radius: 2px;
    margin-bottom: 8px;
    font-size: 11px;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 4px 8px;
    border-radius: 2px;
    margin-bottom: 8px;
    font-size: 11px;
}

/* Validation styles */
.form-control.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25);
}

.error-message {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-control.error:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25);
}