:root {
    color-scheme: dark;
    --bg-1: #07141f;
    --bg-2: #0f2c3b;
    --bg-3: #183d45;
    --surface: rgba(8, 19, 29, 0.72);
    --surface-strong: rgba(10, 27, 39, 0.9);
    --border: rgba(176, 221, 217, 0.18);
    --text: #ecf8f5;
    --muted: #bfd7d2;
    --accent: #9af3d6;
    --accent-strong: #58e1d6;
    --warning: #f6d58c;
    --danger: #f87171;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    font-family: "Manrope", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(88, 225, 214, 0.24), transparent 32%),
        radial-gradient(circle at 80% 20%, rgba(154, 243, 214, 0.16), transparent 22%),
        linear-gradient(140deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3));
}

body::before, body::after {
    content: "";
    position: fixed;
    inset: auto;
    pointer-events: none;
    z-index: 0;
    border-radius: 999px;
    filter: blur(12px);
}

body::before {
    top: 7rem; left: -4rem;
    width: 18rem; height: 18rem;
    background: rgba(88, 225, 214, 0.12);
}

body::after {
    right: 6%; bottom: 8%;
    width: 14rem; height: 14rem;
    background: rgba(246, 213, 140, 0.09);
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

/* ── Header ── */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 20px;
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(12, 29, 42, 0.88), rgba(8, 18, 28, 0.78));
    border: 1px solid var(--border);
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.brand-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-admin {
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 160ms, border-color 160ms;
}

.nav-admin:hover { color: var(--accent); border-color: rgba(154, 243, 214, 0.35); }

/* ── Hero ── */
.store-hero {
    padding: 2rem 0 1rem;
    margin-bottom: 2rem;
}

.store-hero h1 {
    font-family: "Fraunces", serif;
    font-size: clamp(2.8rem, 6vw, 4.8rem);
    font-weight: 700;
    line-height: 1.05;
    margin: 0.75rem 0;
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.lead {
    margin: 0.75rem 0 0;
    font-size: 1.15rem;
    line-height: 1.65;
    color: var(--muted);
}

.accent-link { color: var(--accent); font-weight: 700; text-decoration: none; }
.accent-link:hover { text-decoration: underline; }

/* ── Product grid ── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.product-card, .product-skeleton {
    border-radius: 24px;
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(12, 29, 42, 0.88), rgba(8, 18, 28, 0.78));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.product-skeleton {
    height: 260px;
    background: linear-gradient(180deg, rgba(12, 29, 42, 0.6), rgba(8, 18, 28, 0.5));
    animation: reveal-up 700ms ease forwards, shimmer 1.6s ease-in-out infinite alternate;
}

@keyframes shimmer {
    from { opacity: 0.5; }
    to { opacity: 0.85; }
}

.product-card {
    display: flex;
    flex-direction: column;
    padding: 1.75rem;
}

.product-card-body { flex: 1; }

.product-code {
    margin: 0 0 0.4rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.product-card h3 {
    margin: 0 0 0.75rem;
    font-family: "Fraunces", serif;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
}

.product-desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    gap: 0.75rem;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
}

.product-price.muted { color: var(--muted); font-size: 1rem; font-weight: 600; }

.btn-buy {
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: #031c1a;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: 0 8px 24px rgba(88, 225, 214, 0.22);
    transition: transform 160ms ease, box-shadow 160ms ease;
    white-space: nowrap;
}

.btn-buy:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(88, 225, 214, 0.3); }
.btn-buy:disabled { opacity: 0.35; cursor: not-allowed; background: rgba(255,255,255,0.1); color: var(--muted); box-shadow: none; }

/* ── Modal ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(4, 11, 18, 0.82);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    position: relative;
    width: min(480px, 100%);
    padding: 2rem;
    border-radius: 28px;
    backdrop-filter: blur(20px);
    background: linear-gradient(180deg, rgba(14, 34, 50, 0.97), rgba(8, 20, 32, 0.97));
    border: 1px solid var(--border);
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 160ms, border-color 160ms;
}
.modal-close:hover { color: var(--text); border-color: rgba(154, 243, 214, 0.3); }

.modal h2 {
    font-family: "Fraunces", serif;
    font-size: 1.9rem;
    font-weight: 700;
    margin: 0.3rem 0 0;
    line-height: 1.1;
}

.modal-price {
    margin: 0.5rem 0 1.25rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

/* ── Checkout form ── */
.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.6rem;
}

.field-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-family: inherit;
    font-size: 0.98rem;
    outline: none;
    transition: border-color 160ms;
}
.field-input:focus { border-color: rgba(154, 243, 214, 0.4); }
.field-input::placeholder { color: rgba(191, 215, 210, 0.35); }

.field-hint {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.55;
    opacity: 0.75;
}

.modal-error {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: var(--danger);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── Status pill ── */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(154, 243, 214, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
}
.status-pill.is-live { border-color: rgba(154, 243, 214, 0.28); color: var(--accent); }
.status-pill.is-down { border-color: rgba(246, 213, 140, 0.28); color: var(--warning); }

/* ── Success page ── */
.success-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    text-align: center;
}

.success-card {
    width: min(540px, 100%);
    padding: 2.5rem 2rem;
    border-radius: 28px;
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(12, 29, 42, 0.92), rgba(8, 18, 28, 0.88));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.success-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: rgba(154, 243, 214, 0.15);
    border: 1px solid rgba(154, 243, 214, 0.3);
    color: var(--accent);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.success-card h1 {
    font-family: "Fraunces", serif;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.success-meta {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0 0 1.75rem;
}

.license-block {
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(154, 243, 214, 0.2);
    border-radius: 14px;
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 160ms;
    user-select: all;
    margin-bottom: 0.6rem;
}
.license-block:hover { border-color: rgba(154, 243, 214, 0.45); }

.license-key {
    font-family: "Courier New", monospace;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent);
    word-break: break-all;
}

.copy-hint {
    margin: 0.4rem 0 1.5rem;
    font-size: 0.8rem;
    color: var(--muted);
    opacity: 0.7;
}

.success-warning {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(246, 213, 140, 0.1);
    border: 1px solid rgba(246, 213, 140, 0.25);
    color: var(--warning);
    font-size: 0.88rem;
    line-height: 1.55;
    text-align: left;
    margin-bottom: 1.5rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: border-color 160ms, background 160ms;
}
.btn-secondary:hover { border-color: rgba(154, 243, 214, 0.3); background: rgba(154, 243, 214, 0.05); }

/* ── Admin page ── */
.admin-shell {
    position: relative;
    z-index: 1;
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 20px;
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(12, 29, 42, 0.88), rgba(8, 18, 28, 0.78));
    border: 1px solid var(--border);
}

.admin-title { font-weight: 800; font-size: 1rem; }

.admin-logout {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    transition: color 160ms;
}
.admin-logout:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); }

.admin-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.admin-login-card {
    width: min(400px, 100%);
    padding: 2rem;
    border-radius: 24px;
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(12, 29, 42, 0.92), rgba(8, 18, 28, 0.88));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.admin-login-card h2 {
    font-family: "Fraunces", serif;
    font-size: 1.7rem;
    margin: 0 0 1.5rem;
}

.btn-primary {
    width: 100%;
    padding: 0.8rem 1.25rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 700;
    color: #031c1a;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    margin-top: 0.75rem;
    transition: opacity 160ms;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(12, 29, 42, 0.88), rgba(8, 18, 28, 0.78));
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin: 0 0 0.4rem;
}

.stat-value {
    font-family: "Fraunces", serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.admin-card {
    border-radius: 20px;
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(12, 29, 42, 0.88), rgba(8, 18, 28, 0.78));
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-card-header h3 {
    font-family: "Fraunces", serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.filter-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.filter-input, .filter-select {
    padding: 0.45rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}
.filter-input:focus, .filter-select:focus { border-color: rgba(154, 243, 214, 0.4); }
.filter-input::placeholder { color: rgba(191, 215, 210, 0.35); }
.filter-select option { background: #0f2c3b; }

.license-table-wrap { overflow-x: auto; }

.license-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.license-table th {
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.license-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(176, 221, 217, 0.07);
    vertical-align: middle;
}

.license-table tr:last-child td { border-bottom: none; }
.license-table tr:hover td { background: rgba(154, 243, 214, 0.03); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.badge-active { background: rgba(154, 243, 214, 0.12); color: var(--accent); border: 1px solid rgba(154, 243, 214, 0.2); }
.badge-revoked { background: rgba(248, 113, 113, 0.12); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.2); }
.badge-expired { background: rgba(246, 213, 140, 0.12); color: var(--warning); border: 1px solid rgba(246, 213, 140, 0.2); }

.table-key { font-family: "Courier New", monospace; font-size: 0.82rem; color: var(--accent); }
.table-email { color: var(--muted); }

.btn-table-action {
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    transition: color 160ms, border-color 160ms;
    margin-right: 0.3rem;
}
.btn-table-action:hover { color: var(--text); border-color: rgba(154, 243, 214, 0.3); }
.btn-table-action.danger:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.issue-form {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.issue-form .field-group { display: flex; flex-direction: column; gap: 0.35rem; }
.issue-form .field-group.full { grid-column: 1 / -1; }

.issue-form .field-label { margin: 0; }
.issue-form .btn-primary { grid-column: 1 / -1; }

.detail-panel {
    padding: 1.5rem;
}

.detail-panel h4 {
    font-family: "Fraunces", serif;
    font-size: 1.1rem;
    margin: 0 0 1rem;
}

.detail-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.detail-row strong { color: var(--muted); min-width: 130px; }

.activation-list { margin-top: 1rem; }
.activation-item {
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.activation-device { font-weight: 700; }
.activation-meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    padding: 0.75rem 1.25rem;
    border-radius: 14px;
    background: rgba(12, 40, 55, 0.97);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    animation: reveal-up 300ms ease forwards;
}
.toast.success { border-color: rgba(154, 243, 214, 0.35); color: var(--accent); }
.toast.error { border-color: rgba(248, 113, 113, 0.35); color: var(--danger); }

/* ── Animations ── */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    animation: reveal-up 700ms ease forwards;
}

.site-header.reveal { animation-delay: 0ms; }
.store-hero.reveal { animation-delay: 60ms; }

@keyframes reveal-up {
    to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .product-grid { grid-template-columns: 1fr 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .issue-form { grid-template-columns: 1fr; }
    .issue-form .field-group.full { grid-column: 1; }
    .issue-form .btn-primary { grid-column: 1; }
}

@media (max-width: 600px) {
    .product-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .page-shell, .admin-shell { width: calc(100% - 1.25rem); padding-top: 1rem; }
    .store-hero h1 { font-size: clamp(2.2rem, 12vw, 3.2rem); }
}
