/* Базовые стили */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    background: #f3f4f6;
    color: #111827;
}

/* Общий лэйаут: боковая панель + контент */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Сайдбар */
.sidebar {
    width: 230px;
    background: #111827; /* темный как в админке WP */
    color: #e5e7eb;
    padding: 16px 12px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
}

.sidebar-logo {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding: 8px 10px;
    color: #fff;
    border-radius: 6px;
    background: #2563eb;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
    margin: 12px 6px 4px;
}

.sidebar-link {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 13px;
}

.sidebar-link:hover {
    background: #1f2937;
}

.sidebar-link.is-active {
    background: #1d4ed8;
    color: #fff;
}

/* Основной контент */
.main-content {
    margin-left: 230px;
    padding: 16px 24px 32px;
    width: 100%;
}

/* Шапка страницы */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 8px;
}

/* Карточки / панели (фильтры, формы) */
.card {
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 12px 14px;
    margin-bottom: 12px;
}

/* Формы / фильтры */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}

.filter-form label {
    font-size: 13px;
}

.filter-form input[type="text"],
.filter-form input[type="date"],
.filter-form select {
    padding: 4px 6px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    min-width: 140px;
}

.filter-form button,
.filter-form a {
    white-space: nowrap;
}

/* Таблицы */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.table th,
.table td {
    padding: 7px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.table th {
    background: #f9fafb;
    font-weight: 500;
    font-size: 13px;
}

.table tbody tr:nth-child(even) {
    background: #f9fafb;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #ffffff;
    border-color: #d1d5db;
    color: #111827;
}

.btn-secondary:hover {
    background: #f3f4f6;
}

/* Статусы заказов */
.status-label {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}

.status-new        { background: #fee2e2; color: #b91c1c; }
.status-processing { background: #fef3c7; color: #92400e; }
.status-shipped    { background: #dbebff; color: #1d4ed8; }
.status-done       { background: #dcfce7; color: #166534; }
.status-cancelled  { background: #e5e7eb; color: #4b5563; text-decoration: line-through; }

/* Картинки товаров */
.thumb {
    max-width: 60px;
    max-height: 60px;
    border-radius: 4px;
    object-fit: cover;
}

/* Сообщения */
.errors {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.success {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

/* Формы редактирования */
.form-field {
    margin-bottom: 10px;
}

.form-field label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}

/* Таблица остатков в карточке товара/заказа */
.subtable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}

.subtable th,
.subtable td {
    border: 1px solid #e5e7eb;
    padding: 4px 6px;
    font-size: 12px;
    background: #f9fafb;
}

/* Мелочи */
.text-muted {
    color: #6b7280;
    font-size: 12px;
}

/* Сетка шапки заказа */
.order-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 16px;
    margin-bottom: 10px;
}

@media (max-width: 1000px) {
    .order-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .order-form-grid {
        grid-template-columns: 1fr;
    }
}

.card h3 {
    margin-top: 18px;
    margin-bottom: 8px;
}

.table {
    margin-top: 6px;
}
