/* ============================================================
   HotWheelz.ru — Админка (стиль 1С-Битрикс)
   Плотные таблицы, серо-белая палитра, сайдбар
   ============================================================ */

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 13px;
    color: #1f1f1f;
    background: #f0f1f4;
}

a { color: #2067b0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   ЛЕЙАУТ
   ============================================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   САЙДБАР
   ============================================================ */
.sidebar {
    width: 240px;
    background: #1f4e79;
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 14px 16px;
    background: #163d5e;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #2a5d8f;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-brand .logo {
    width: 22px; height: 22px;
    background: #f47920;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 12px;
}

.sidebar-menu {
    list-style: none;
    padding: 8px 0;
    flex: 1;
}

.sidebar-menu li { position: relative; }

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: #d6e4f0;
    font-size: 13px;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: #2a5d8f;
    color: #fff;
    text-decoration: none;
}

.sidebar-menu a.active {
    background: #2a5d8f;
    color: #fff;
    border-left-color: #f47920;
}

.sidebar-menu .section {
    padding: 10px 16px 4px;
    font-size: 11px;
    text-transform: uppercase;
    color: #8aa9c4;
    letter-spacing: 0.5px;
}

.sidebar-menu .icon {
    width: 16px; height: 16px;
    display: inline-block;
    text-align: center;
    font-size: 14px;
}

.sidebar-footer {
    padding: 10px 16px;
    background: #163d5e;
    font-size: 12px;
    color: #8aa9c4;
    border-top: 1px solid #2a5d8f;
}

/* ============================================================
   ОСНОВНАЯ ЗОНА
   ============================================================ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ============================================================
   ШАПКА
   ============================================================ */
.topbar {
    height: 44px;
    background: #fff;
    border-bottom: 1px solid #d8dde3;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
}

.topbar .crumbs {
    color: #6a737b;
    font-size: 13px;
}

.topbar .crumbs a { color: #2067b0; }

.topbar .spacer { flex: 1; }

.topbar .user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1f1f1f;
}

.topbar .user .avatar {
    width: 28px; height: 28px;
    background: #1f4e79;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.topbar .user a.logout {
    color: #c0392b;
    margin-left: 8px;
}

/* ============================================================
   КОНТЕНТ
   ============================================================ */
.content {
    padding: 16px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #d8dde3;
}

.page-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #1f1f1f;
}

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

/* ============================================================
   КНОПКИ
   ============================================================ */
.btn {
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #c5cdd5;
    color: #1f1f1f;
    font-size: 12px;
    border-radius: 2px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { background: #f5f7f9; text-decoration: none; }

.btn-primary {
    background: #1f4e79;
    border-color: #1f4e79;
    color: #fff;
}
.btn-primary:hover { background: #2a5d8f; }

.btn-success {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
}
.btn-success:hover { background: #5cba60; }

.btn-danger {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}
.btn-danger:hover { background: #d04a3c; }

.btn-sm { padding: 3px 8px; font-size: 11px; }

/* ============================================================
   КАРТОЧКИ / ПАНЕЛИ
   ============================================================ */
.panel {
    background: #fff;
    border: 1px solid #d8dde3;
    border-radius: 2px;
    margin-bottom: 14px;
}

.panel-header {
    padding: 8px 12px;
    background: #f5f7f9;
    border-bottom: 1px solid #d8dde3;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-body { padding: 12px; }

/* ============================================================
   ТАБЛИЦЫ (плотные, в стиле Битрикс)
   ============================================================ */
.table-wrap {
    background: #fff;
    border: 1px solid #d8dde3;
    border-radius: 2px;
    overflow: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

table.data thead th {
    background: #eef1f4;
    border: 1px solid #d8dde3;
    border-top: none;
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    color: #1f1f1f;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

table.data tbody td {
    border: 1px solid #e3e7eb;
    padding: 5px 8px;
    vertical-align: middle;
}

table.data tbody tr:nth-child(even) { background: #fafbfc; }
table.data tbody tr:hover { background: #fff7e6; }

table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .center { text-align: center; }

table.data .actions {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

/* ============================================================
   ФОРМЫ
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 8px 12px;
    align-items: center;
}

.form-grid label {
    text-align: right;
    color: #1f1f1f;
    font-size: 12px;
    padding-right: 4px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-control,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #c5cdd5;
    border-radius: 2px;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
    color: #1f1f1f;
}

textarea { min-height: 80px; resize: vertical; }

.form-control:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #1f4e79;
    box-shadow: 0 0 0 2px rgba(31,78,121,0.15);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.form-row label { font-size: 12px; color: #1f1f1f; }

.form-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e3e7eb;
    display: flex;
    gap: 8px;
}

/* ============================================================
   ФИЛЬТРЫ (над таблицей)
   ============================================================ */
.filters {
    background: #fff;
    border: 1px solid #d8dde3;
    border-radius: 2px;
    padding: 10px 12px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filters .field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filters .field label {
    font-size: 11px;
    color: #6a737b;
}

.filters .field input,
.filters .field select {
    min-width: 160px;
    padding: 4px 6px;
    font-size: 12px;
}

.filters .actions {
    display: flex;
    gap: 6px;
    align-self: flex-end;
}

/* ============================================================
   БЕЙДЖИ / СТАТУСЫ
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: #e3e7eb;
    color: #1f1f1f;
    white-space: nowrap;
}

.badge-new      { background: #e3f2fd; color: #1565c0; }
.badge-paid     { background: #e8f5e9; color: #2e7d32; }
.badge-shipped  { background: #fff3e0; color: #e65100; }
.badge-delivered{ background: #c8e6c9; color: #1b5e20; }
.badge-cancelled{ background: #ffebee; color: #c62828; }
.badge-hit      { background: #fce4ec; color: #ad1457; }
.badge-active   { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #ffebee; color: #c62828; }

/* ============================================================
   ПАГИНАЦИЯ
   ============================================================ */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #d8dde3;
    border-top: none;
    border-radius: 0 0 2px 2px;
    font-size: 12px;
}

.pagination a, .pagination span {
    padding: 4px 8px;
    border: 1px solid #d8dde3;
    background: #fff;
    color: #2067b0;
    border-radius: 2px;
}

.pagination .current {
    background: #1f4e79;
    color: #fff;
    border-color: #1f4e79;
}

.pagination .disabled {
    color: #aaa;
    background: #f5f7f9;
}

.pagination .info {
    margin-left: auto;
    color: #6a737b;
}

/* ============================================================
   АЛЕРТЫ
   ============================================================ */
.alert {
    padding: 8px 12px;
    border-radius: 2px;
    margin-bottom: 12px;
    font-size: 12px;
    border: 1px solid;
}

.alert-success { background: #e8f5e9; border-color: #4caf50; color: #2e7d32; }
.alert-error   { background: #ffebee; border-color: #c0392b; color: #c62828; }
.alert-warning { background: #fff3e0; border-color: #f47920; color: #e65100; }
.alert-info    { background: #e3f2fd; border-color: #2067b0; color: #1565c0; }

/* ============================================================
   СТАТИСТИКА НА ДАШБОРДЕ
   ============================================================ */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.stat-card {
    background: #fff;
    border: 1px solid #d8dde3;
    border-radius: 2px;
    padding: 12px 14px;
}

.stat-card .label {
    font-size: 11px;
    color: #6a737b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 24px;
    font-weight: 600;
    color: #1f4e79;
    margin-top: 4px;
}

.stat-card .delta {
    font-size: 11px;
    color: #6a737b;
    margin-top: 2px;
}

/* ============================================================
   ЛОГИН
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1f4e79 0%, #2a5d8f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    overflow: hidden;
}

.login-box .head {
    background: #1f4e79;
    color: #fff;
    padding: 16px;
    text-align: center;
}

.login-box .head .logo {
    width: 40px; height: 40px;
    background: #f47920;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 8px;
}

.login-box .head h1 {
    font-size: 16px;
    font-weight: 600;
}

.login-box .head .sub {
    font-size: 12px;
    color: #d6e4f0;
    margin-top: 2px;
}

.login-box .body { padding: 20px; }

.login-box .field {
    margin-bottom: 12px;
}

.login-box .field label {
    display: block;
    font-size: 12px;
    color: #1f1f1f;
    margin-bottom: 4px;
}

.login-box .field input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
}

.login-box .submit {
    width: 100%;
    padding: 9px;
    background: #1f4e79;
    color: #fff;
    border: none;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

.login-box .submit:hover { background: #2a5d8f; }

.login-box .hint {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e3e7eb;
    font-size: 11px;
    color: #6a737b;
    text-align: center;
}

/* ============================================================
   УТИЛИТЫ
   ============================================================ */
.muted { color: #6a737b; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.flex { display: flex; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.between { justify-content: space-between; }
.center { align-items: center; }
.nowrap { white-space: nowrap; }
