:root {
    --purple: #5b21b6;
    --purple-dark: #32105f;
    --purple-light: #8b5cf6;
    --bg: #f6f4fb;
    --text: #1f172a;
    --muted: #6b6474;
    --white: #fff;
    --green: #0f9f6e;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #2563eb;
    --radius: 22px;
    --shadow: 0 18px 50px rgba(49, 16, 95, .12);
}

* { box-sizing: border-box; }

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

a { color: inherit; }

.site-hero {
    background: radial-gradient(circle at top left, #8b5cf6, #5b21b6 45%, #211033);
    color: white;
    padding: 28px 24px 64px;
}

.site-hero nav {
    max-width: 1180px;
    margin: 0 auto 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: -.04em;
}

.brand span { color: #ddd6fe; }

.nav-button,
.buy-button,
.lead-form button,
.panel button,
.login-card button {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: white;
    border: 0;
    border-radius: 999px;
    padding: 13px 20px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    font-weight: 800;
    box-shadow: 0 12px 22px rgba(91, 33, 182, .22);
}

.hero-content {
    max-width: 1180px;
    margin: 0 auto;
}

.hero-content h1 {
    max-width: 760px;
    font-size: clamp(2.1rem, 6vw, 4.8rem);
    line-height: .96;
    margin: 0 0 20px;
    letter-spacing: -.06em;
}

.hero-content p {
    max-width: 620px;
    font-size: 1.2rem;
    color: #e9ddff;
}

.container {
    max-width: 1180px;
    margin: -34px auto 60px;
    padding: 0 24px;
}

.categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px;
    background: rgba(255,255,255,.8);
    border-radius: 999px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.categories a {
    text-decoration: none;
    white-space: nowrap;
    padding: 10px 16px;
    border-radius: 999px;
    color: var(--purple-dark);
    font-weight: 700;
}

.categories a.active {
    background: var(--purple);
    color: white;
}

.cache-info {
    color: var(--muted);
    margin: 22px 6px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
}

.product-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    background: #ff7733;
    color: white;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: .72rem;
    font-weight: 900;
}

.image-wrap {
    height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 16px;
}

.image-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-body {
    padding: 18px;
}

.product-body h2 {
    font-size: .98rem;
    line-height: 1.25;
    min-height: 62px;
    margin: 0 0 12px;
}

.meta,
.details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: .84rem;
}

.old-price {
    margin-top: 14px;
    color: var(--muted);
    text-decoration: line-through;
}

.price {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--purple-dark);
    margin: 2px 0 8px;
}

.commission {
    margin: 12px 0;
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eee7ff;
    color: var(--purple-dark);
    font-size: .82rem;
    font-weight: 900;
}

.buy-button {
    width: 100%;
    text-align: center;
    margin-top: 10px;
}

.lead-section {
    margin-top: 56px;
    background: white;
    border-radius: 32px;
    box-shadow: var(--shadow);
    padding: 32px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.lead-section h2 {
    font-size: 2rem;
    margin-top: 0;
}

.lead-form,
.panel form,
.login-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #ddd7eb;
    border-radius: 14px;
    padding: 13px 14px;
    font: inherit;
    background: white;
}

textarea {
    min-height: 220px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

label {
    font-weight: 800;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    color: var(--muted);
}

.check input {
    width: auto;
    margin-top: 5px;
}

footer {
    text-align: center;
    color: var(--muted);
    padding: 32px;
}

.alert {
    border-radius: 18px;
    padding: 16px 18px;
    margin: 16px 0;
}

.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* Admin */
.admin-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--purple-dark), var(--purple));
}

.login-card {
    width: min(420px, calc(100% - 32px));
    background: white;
    border-radius: 30px;
    box-shadow: var(--shadow);
    padding: 34px;
}

.login-card h1 {
    margin: 0;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.admin-shell aside {
    background: var(--purple-dark);
    color: white;
    padding: 28px;
}

.admin-shell aside h2 {
    margin-top: 0;
}

.admin-shell aside a {
    display: block;
    color: #ede9fe;
    text-decoration: none;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.admin-shell main {
    padding: 32px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.card,
.panel {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.card span {
    color: var(--muted);
    display: block;
}

.card strong {
    font-size: 1.7rem;
}

.table-wrap {
    overflow-x: auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eee8f8;
}

th {
    color: var(--purple-dark);
    font-size: .86rem;
    text-transform: uppercase;
}

.grid-form {
    display: grid !important;
    grid-template-columns: 180px 1fr;
    align-items: center;
}

.grid-form button {
    grid-column: 2;
    justify-self: start;
}

.success-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.success-card {
    max-width: 520px;
    background: white;
    border-radius: 30px;
    box-shadow: var(--shadow);
    padding: 34px;
    text-align: center;
}

.secondary-link {
    display: block;
    margin-top: 18px;
    color: var(--purple);
}

@media (max-width: 1050px) {
    .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lead-section { grid-template-columns: 1fr; }
    .admin-shell { grid-template-columns: 1fr; }
    .admin-shell aside { position: static; }
}

@media (max-width: 520px) {
    .products-grid { grid-template-columns: 1fr; }
    .categories { border-radius: 20px; }
    .grid-form { grid-template-columns: 1fr; }
    .grid-form button { grid-column: 1; }
}
