:root {
    --primary: #c8161f;
    --primary-dark: #7a0d12;
    --accent: #f5a623;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --border: #e2e8f0;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.site-header {
    background: #fff;
    color: var(--text);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .08);
    border-bottom: 3px solid var(--primary);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.logo { height: 36px; display: block; }
.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a {
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    position: relative;
    padding: 9px 16px;
    border-radius: 999px;
    transition: background .15s ease, color .15s ease;
}
.main-nav a:hover { background: #fdecec; color: var(--primary); }
.main-nav a.cart-link { display: inline-flex; align-items: center; }
.main-nav a:last-child { color: var(--muted); }
.main-nav a:last-child:hover { background: #f1f5f9; color: var(--text); }
.cart-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    margin-left: 6px;
}

main.container { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(120deg, var(--primary-dark) 0%, var(--primary) 55%, #e2412e 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 40px 36px;
    margin-bottom: 32px;
    box-shadow: 0 12px 30px rgba(200, 22, 31, .25);
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 85% 20%, rgba(255,255,255,.16) 0, transparent 45%),
        repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 2px, transparent 2px 26px);
    pointer-events: none;
}
.hero-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero-badge {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}
.hero-text h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.3px; }
.hero-text p { margin: 0; color: rgba(255,255,255,.85); font-size: 15px; max-width: 560px; }

/* Order cards */
.order-card { padding: 0; overflow: hidden; }
.order-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}
.order-header .badge { margin-left: 10px; }
.order-meta { display: flex; align-items: center; gap: 18px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.order-total { font-weight: 700; color: var(--primary); font-size: 16px; }
.order-items { margin: 0; border: none; }
.order-items th, .order-items td { padding: 10px 20px; }
.order-items thead th { background: #fff; }

/* Category filter */
.category-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.category-tabs a {
    padding: 6px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    color: var(--muted);
}
.category-tabs a.active, .category-tabs a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (min-width: 640px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
    .product-grid { grid-template-columns: repeat(4, 1fr); }
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}
.product-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.product-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f1f5f9; }
.product-card .body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .code { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.product-card .name { font-size: 14px; font-weight: 600; line-height: 1.3; min-height: 36px; }
.price-row { margin-top: auto; display: flex; align-items: baseline; gap: 8px; }
.price-old { text-decoration: line-through; color: var(--muted); font-size: 13px; }
.price-now { color: var(--accent); font-weight: 700; font-size: 17px; }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--primary-dark); }
.btn.btn-accent { background: var(--accent); }
.btn.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn.btn-danger { background: #dc2626; }
.btn.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }

/* Auth pages */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(20, 4, 4, .82), rgba(90, 10, 14, .78)),
        url('/assets/img/oto-ekspertiz-bg.png') center center / cover no-repeat;
    padding: 16px;
}
.auth-card {
    background: rgba(255, 255, 255, .97);
    border-radius: var(--radius);
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.auth-card img { height: 56px; margin-bottom: 18px; }
.auth-card h2 { margin: 0 0 20px; font-size: 20px; }
.error-msg { background: #fee2e2; color: #b91c1c; padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; text-align: left; }
.success-msg { background: #dcfce7; color: #166534; padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; text-align: left; }

/* Cart */
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.cart-table th, .cart-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.cart-table img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.cart-table input[type="number"] { width: 60px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; }
.cart-summary { margin-top: 20px; text-align: right; }
.cart-summary .total { font-size: 20px; font-weight: 700; margin-bottom: 12px; }

@media (max-width: 640px) {
    .cart-table thead { display: none; }
    .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; width: 100%; }
    .cart-table tr { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; }
    .cart-table td { border: none; display: flex; justify-content: space-between; align-items: center; }
    .cart-table td::before { content: attr(data-label); font-weight: 600; color: var(--muted); }
}

/* Admin layout */
.admin-body { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: var(--primary-dark); color: #fff; padding: 20px 0; flex-shrink: 0; }
.admin-sidebar .brand { display: block; text-align: center; margin-bottom: 24px; }
.admin-sidebar .brand img { height: 40px; }
.admin-sidebar a { display: block; padding: 12px 24px; color: #cbd5e1; font-size: 14px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,.08); color: #fff; }
.admin-content { flex: 1; padding: 28px; max-width: 100%; overflow-x: auto; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 10px; }
.admin-topbar h1 { margin: 0; font-size: 22px; }

@media (max-width: 800px) {
    .admin-body { flex-direction: column; }
    .admin-sidebar { width: 100%; display: flex; align-items: center; overflow-x: auto; padding: 10px; }
    .admin-sidebar .brand { display: none; }
    .admin-sidebar a { padding: 8px 14px; white-space: nowrap; }
}

table.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
table.data-table th, table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; text-align: left; }
table.data-table th { background: #f1f5f9; }
table.data-table img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.inactive { background: #fee2e2; color: #b91c1c; }

.card { background: #fff; border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); margin-bottom: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

/* Legal / payment footer bar */
.legal-footer {
    background: #14181f;
    color: #cbd5e1;
    padding: 28px 0;
    margin-top: 40px;
}
.legal-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 13px; }
.legal-links a { color: #cbd5e1; }
.legal-links a:hover { color: #fff; text-decoration: underline; }
.payment-band img { max-width: 320px; width: 100%; height: auto; filter: brightness(1.05); }
.legal-copy { font-size: 12px; color: #6b7280; }

.legal-page { background: #fff; border-radius: var(--radius); padding: 32px; max-width: 820px; margin: 0 auto; line-height: 1.7; }
.legal-page h1 { margin-top: 0; }
.legal-page h2 { font-size: 18px; margin-top: 28px; }
.public-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.public-topbar { background: var(--primary); padding: 14px 0; }
.public-topbar .container { display: flex; align-items: center; justify-content: space-between; }
.public-topbar img { height: 36px; }
.public-topbar a.btn { padding: 8px 16px; }
.public-main { flex: 1; padding: 32px 16px; }
