* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    background: #f3f5f9;
    font-family: Arial, sans-serif;
    color: #222;
}

header {
    background: #fff;
    box-shadow: 0 1px 0 #ececec;
}

.topbar {
    display: flex;
    align-items: center;
    position: relative;
    padding: 18px 0 0 32px;
}

.logo-img {
    height: 42px;
    width: auto;
    margin-left: 24px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.logo-img:hover {
    opacity: 0.8;
}

.burger-menu {
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.burger-bar {
    width: 26px;
    height: 3px;
    background: #232323;
    border-radius: 2px;
}

.telegram-link {
    position: absolute;
    right: 32px;
    top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    box-shadow: 0 2px 10px #e2e8f0;
    transition: background 0.3s, box-shadow 0.3s;
    text-decoration: none;
}

.telegram-link:hover {
    background: #1abc9c;
    box-shadow: 0 4px 16px rgba(26, 188, 156, 0.4);
}

.telegram-icon {
    width: 22px;
    height: 22px;
    display: block;
}

.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 255px;
    height: 100vh;
    background: #f7f7f7;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.07);
    z-index: 2000;
    border-radius: 0 0 6px 0;
    transform: translateX(-110%);
    transition: transform 0.35s cubic-bezier(0.57,0.04,0.45,1.01);
    padding: 32px 0 0 24px;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar li {
    font-size: 1.15em;
    color: #232a38;
    margin-bottom: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.18s;
}

.sidebar li:hover {
    color: #1abc9c;
}

.page { 
    display: none; 
}

.page.active { 
    display: block; 
}

.main-title {
    font-size: 2em;
    font-weight: bold;
    margin-top: 40px;
    margin-bottom: 8px;
    text-align: center;
    color: #202a40;
}

.main-desc {
    color: #313957;
    margin-bottom: 24px;
    margin-top: 0;
    font-size: 1.02em;
    text-align: center;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    max-width: calc(3 * 330px + 2 * 14px);
    margin: 0 auto;
    padding: 0;
}

.card {
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 2px 14px #e2e8f0;
    width: 100%;
    max-width: 330px;
    height: 330px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.card:hover {
    box-shadow: 0 6px 30px #d6dee7;
    transform: translateY(-8px);
}

.card-illustration {
    width: 145px;
    min-height: 128px;
    margin: 28px auto 12px;
    display: block;
    align-self: center;
    object-fit: contain;
}

.card-title {
    font-size: 1.12em;
    font-weight: bold;
    color: #21304c;
    margin-left: 16px;
    margin-bottom: 12px;
    margin-top: 0;
}

.card-link {
    color: #bbb;
    font-size: 1em;
    text-decoration: none;
    margin-left: 16px;
    margin-top: 2px;
    transition: color 0.18s;
}

.card-link:hover {
    color: #1abc9c;
    text-decoration: underline;
}

.center-panel {
    width: 1120px;
    min-height: 500px;
    margin: 52px auto 0;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 8px 46px #e2e8f0;
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-back {
    text-align: left;
    width: 90%;
    margin-bottom: 8px;
}

.arrow-img {
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: transform 0.2s;
}

.arrow-img:hover {
    transform: scale(1.1);
}

.center-title {
    font-size: 1.54em;
    font-weight: bold;
    color: #1a253e;
    margin-bottom: 8px;
    margin-top: 0;
    text-align: left;
    width: 90%;
    letter-spacing: 0.01em;
}

.subtitle {
    color: #6e7483;
    font-size: 0.99em;
    margin-bottom: 12px;
    width: 90%;
    text-align: left;
}

.center-content {
    background: #fafbfc;
    border-radius: 18px;
    min-height: 300px;
    width: 92%;
    box-shadow: 0 1px 0 #ececec;
    overflow-x: auto;
    padding: 0;
}

/* ===== ТАБЛИЦА ===== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    background: #fff;
    font-size: 0.95em;
}

.data-table thead {
    background: #1abc9c;
    color: white;
    font-weight: 600;
}

.data-table th {
    padding: 14px 10px;
    text-align: center;
    border: 1px solid #ddd;
}

.data-table td {
    padding: 14px 10px;
    text-align: center;
    border: 1px solid #ddd;
    color: #333;
}

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

.data-table tbody tr:hover {
    background: #f0f7f6;
}

.data-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: #1a253e;
}

/* ===== ЗТК ПОИСК И ФИЛЬТР ===== */

.ztk-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 16px;
}

.ztk-search .search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    transition: border-color 0.2s;
}

.ztk-search .search-input:focus {
    outline: none;
    border-color: #1abc9c;
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

/* ===== СТАТУСЫ (ЦВЕТНЫЕ БЕЙДЖИ) ===== */

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

/* Растаможена - ЗЕЛЕНЫЙ */
.status-badge.status-растаможена {
    background: #28a745;
    color: #fff;
}

/* Ожидает оплаты - ЖЕЛТЫЙ */
.status-badge.status-ожидает-оплаты {
    background: #ffc107;
    color: #000;
}

/* Ожидает оплату утилизационного сбора - РОЗОВЫЙ */
.status-badge.status-ожидает-оплату-утилизационного-сбора {
    background: #f8d7da;
    color: #721c24;
}

/* Ожидает растаможивания - ГОЛУБОЙ */
.status-badge.status-ожидает-растаможивания {
    background: #d1ecf1;
    color: #0c5460;
}

/* Ввоз запрещен - КРАСНЫЙ */
.status-badge.status-ввоз-запрещен {
    background: #dc3545;
    color: #fff;
}

/* ===== ПОИСК КОНТЕЙНЕРА ===== */

.search-container {
    padding: 20px;
    background: #fff;
}

.alert-box {
    display: flex;
    align-items: center;
    background: #fef3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    gap: 12px;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-text {
    color: #856404;
    font-size: 0.95em;
    font-weight: 500;
}

.search-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    font-family: monospace;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #1abc9c;
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

.char-counter {
    font-size: 0.9em;
    color: #666;
    font-weight: 600;
    min-width: 35px;
    text-align: center;
}

.search-btn {
    padding: 12px 28px;
    background: #1abc9c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.search-btn:hover {
    background: #16a085;
    box-shadow: 0 2px 8px rgba(26, 188, 156, 0.3);
}

.search-btn:active {
    background: #138d75;
}

/* ===== ОШИБКИ ===== */

.error-notification {
    position: fixed;
    top: 32px;
    right: 40px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.12);
    padding: 22px 22px 15px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 340px;
    max-width: 370px;
    z-index: 9999;
    opacity: 0;
    transform: translateX(350px);
    transition: all 0.35s cubic-bezier(0.71,0.24,0.27,0.94);
}

.error-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.error-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
}

.error-text {
    flex: 1;
}

.error-text strong {
    color: #f44;
    font-size: 1.13em;
    display: block;
}

.error-text p {
    margin: 4px 0 6px 0;
    color: #333;
    font-size: 0.98em;
}

.error-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0 2px;
    transition: color 0.2s;
}

.error-close:hover {
    color: #111;
}

.error-bar-wrapper {
    width: 100%;
    background: #eef0f4;
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
    margin-top: 4px;
}

.error-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff4444 40%, #ffa444 100%);
    border-radius: 99px;
    animation: errorprogress 3s linear forwards;
}

@keyframes errorprogress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ===== ПАГИНАЦИЯ ===== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border-top: 2px solid #e2e8f0;
}

.pagination-btn {
    padding: 10px 20px;
    background: #1abc9c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: #16a085;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(26, 188, 156, 0.3);
}

.pagination-btn:active {
    transform: translateY(0);
}

.pagination-info {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    min-width: 200px;
    text-align: center;
}

/* ===== АДАПТИВ ===== */

@media (max-width: 1200px) {
    .center-panel {
        width: 96vw;
    }
}

/* ===== ПЛАНШЕТ ===== */
@media (max-width: 1024px) {
    .topbar {
        padding: 16px 0 0 20px;
    }
    .logo-img {
        margin-left: 16px;
    }
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: calc(2 * 330px + 14px);
        padding: 0 16px;
    }
    .center-panel {
        width: 94vw;
        padding: 26px 0;
    }
    .center-title {
        font-size: 1.4em;
    }
    .data-table {
        font-size: 0.9em;
    }
    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }
}

/* ===== ТЕЛЕФОН (до 640px) ===== */
@media (max-width: 640px) {
    .topbar {
        padding: 14px 0 0 16px;
    }
    .logo-img {
        height: 34px;
        margin-left: 12px;
    }
    .burger-bar {
        width: 22px;
    }
    .main-title {
        font-size: 1.6em;
        margin-top: 28px;
    }
    .cards-grid {
        grid-template-columns: 1fr;
        max-width: 420px;
        padding: 0 14px;
    }
    .card {
        height: auto;
        max-width: none;
        padding-bottom: 18px;
    }
    .card-illustration {
        width: 120px;
        min-height: 96px;
        margin: 20px auto 10px;
    }
    .center-panel {
        width: 99vw;
        padding: 5vw 0;
        border-radius: 20px;
        min-height: 320px;
    }
    .center-title,
    .subtitle {
        width: 90%;
    }
    .center-title {
        font-size: 1.3em;
    }
    .center-content {
        width: 94%;
        min-height: 160px;
        overflow-x: visible;       /* карточный режим — горизонтальный скролл не нужен */
        background: transparent;
        box-shadow: none;
    }
    .page-back {
        width: 90%;
    }
    .error-notification {
        right: 10px;
        left: 10px;
        min-width: 0;
        max-width: none;
    }
    .telegram-link {
        right: 16px;
        top: 14px;
        width: 34px;
        height: 34px;
    }
    .arrow-img {
        width: 26px;
        height: 26px;
    }

    /* --- Таблицы превращаются в карточки «label: значение» --- */
    .data-table {
        font-size: 0.92em;
        background: transparent;
    }
    .data-table thead {
        display: none;            /* шапку заменяют data-label у ячеек */
    }
    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }
    .data-table tr {
        margin: 0 12px 12px;
        width: auto;
        background: #fff;
        border: 1px solid #e6eaf0;
        border-radius: 12px;
        box-shadow: 0 1px 6px rgba(20, 40, 80, 0.05);
        overflow: hidden;
    }
    .data-table tbody tr:nth-child(odd) {
        background: #fff;          /* зебру в карточках убираем */
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        text-align: right;
        padding: 11px 14px;
        border: none;
        border-bottom: 1px solid #f0f2f5;
    }
    .data-table tr td:last-child {
        border-bottom: none;
    }
    .data-table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        text-align: left;
        font-weight: 700;
        color: #1a253e;
    }
    .data-table tbody td:first-child {
        text-align: right;         /* VIN тоже выравниваем как значение */
        color: #1a253e;
    }
    /* Служебные строки (Загрузка / Не найдено) — без карточной разбивки */
    .data-table td[colspan] {
        display: block;
        text-align: center !important;
        padding: 24px 14px !important;
    }
    .data-table td[colspan]::before {
        content: none;
    }
    .status-badge {
        white-space: nowrap;
    }

    .ztk-search {
        flex-direction: column;
        padding: 12px;
    }
    .ztk-search .search-input {
        min-width: 100%;
    }
    .search-group {
        flex-wrap: wrap;
    }
    .search-group .search-input {
        flex: 1 1 100%;
    }
    .search-btn {
        flex: 1 1 100%;
    }
    .pagination {
        flex-direction: column;
        gap: 10px;
    }
    .pagination-btn {
        width: 100%;
    }
    .pagination-info {
        font-size: 12px;
        min-width: 0;
    }
}
