:root {
    --bg: #f7f8ff;
    --bg-soft: rgba(255, 255, 255, 0.75);
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --border: rgba(109, 123, 164, 0.16);
    --text: #24304a;
    --muted: #6f7a94;
    --accent: #5166ff;
    --accent-soft: linear-gradient(135deg, #90f0d4 0%, #a6c6ff 48%, #ffd5e2 100%);
    --danger: #d85f73;
    --shadow: 0 24px 60px rgba(85, 98, 146, 0.12);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-display: 'Fraunces', serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
}

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

button, input, textarea, select {
    font: inherit;
}

.app-body, .guest-body {
    position: relative;
    overflow-x: hidden;
}

.app-background, .guest-background {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(246, 179, 202, 0.45), transparent 32%),
        radial-gradient(circle at top right, rgba(168, 216, 234, 0.42), transparent 30%),
        radial-gradient(circle at bottom left, rgba(184, 242, 230, 0.36), transparent 26%),
        linear-gradient(180deg, #fdfcff 0%, #f6f8ff 100%);
    z-index: 0;
}

.app-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
}

.sidebar {
    padding: 32px 24px;
    backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.66);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.35rem;
    background: var(--accent-soft);
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 700;
}

.brand-lockup h1,
.topbar h2,
.section-heading h3,
.install-card h1,
.auth-copy h1,
.hero-card h3 {
    margin: 0;
    font-family: var(--font-display);
    line-height: 1.12;
}

.sidebar-nav {
    display: grid;
    gap: 10px;
}

.nav-link {
    padding: 14px 18px;
    border-radius: 16px;
    color: var(--muted);
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
    color: var(--text);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(81, 102, 255, 0.08);
}

.sidebar-foot {
    margin-top: auto;
    padding: 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.8);
}

.app-main {
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 4px 24px;
}

.topbar-actions, .form-actions, .filter-actions, .row-actions, .modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.content-wrap {
    display: grid;
    gap: 22px;
}

.hero-card,
.surface-card,
.stat-card,
.auth-card,
.auth-panel,
.install-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

.hero-card,
.surface-card,
.install-card {
    padding: 28px;
}

.hero-card {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(255,255,255,0.7)), var(--accent-soft);
}

.hero-card p,
.muted {
    color: var(--muted);
}

.stats-grid,
.grid-two,
.grid-two-form,
.filter-grid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-two-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
    padding: 24px;
    min-height: 160px;
    display: grid;
    gap: 12px;
}

.stat-card strong {
    font-size: 2.2rem;
}

.accent-peach { background: linear-gradient(180deg, #fff6f7 0%, #fff 100%); }
.accent-sky { background: linear-gradient(180deg, #f5fbff 0%, #fff 100%); }
.accent-lime { background: linear-gradient(180deg, #f6fff9 0%, #fff 100%); }
.accent-lilac { background: linear-gradient(180deg, #f8f6ff 0%, #fff 100%); }

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

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

.list-stack {
    display: grid;
    gap: 12px;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(109, 123, 164, 0.12);
}

.list-row p {
    margin: 4px 0 0;
    color: var(--muted);
}

.row-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.insight-stack {
    display: grid;
    gap: 14px;
}

.insight-card {
    padding: 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(109, 123, 164, 0.12);
    display: grid;
    gap: 6px;
}

.insight-card strong {
    font-size: 1.35rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    background: linear-gradient(135deg, #5e73ff 0%, #7ab6ff 100%);
    box-shadow: 0 16px 30px rgba(81, 102, 255, 0.24);
}

.button-secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.88);
    border-color: var(--border);
}

.button-ghost {
    color: var(--muted);
    background: transparent;
    border-color: var(--border);
}

.button-danger {
    color: #fff;
    background: linear-gradient(135deg, #dd7189 0%, #f49cb0 100%);
}

.button-block {
    width: 100%;
}

.field {
    display: grid;
    gap: 9px;
}

.field span {
    font-weight: 700;
    font-size: 0.95rem;
}

.field input,
.field textarea,
.field select,
.tag-editor {
    width: 100%;
    border: 1px solid rgba(109, 123, 164, 0.18);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    padding: 14px 16px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.tag-editor:focus-within {
    border-color: rgba(81, 102, 255, 0.4);
    box-shadow: 0 0 0 4px rgba(81, 102, 255, 0.09);
}

.stack-form {
    display: grid;
    gap: 18px;
}

.price-preview {
    padding: 16px 20px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(168, 216, 234, 0.3), rgba(248, 212, 157, 0.32));
    font-size: 1.05rem;
}

.tag-editor {
    display: grid;
    gap: 12px;
}

.tag-chip-list,
.inline-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-chip,
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.83rem;
    font-weight: 700;
    background: rgba(233, 237, 255, 0.85);
}

.pill-neutral {
    background: rgba(228, 231, 241, 0.78);
}

.tag-chip button {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--muted);
}

.tag-editor-input {
    border: 0;
    padding: 0;
    background: transparent;
}

.upload-dropzone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 170px;
    padding: 24px;
    text-align: center;
    border-radius: 22px;
    border: 2px dashed rgba(81, 102, 255, 0.18);
    background: linear-gradient(180deg, rgba(255,255,255,0.74), rgba(255,255,255,0.92));
}

.upload-dropzone.is-dragover {
    border-color: rgba(81, 102, 255, 0.5);
    background: rgba(255, 255, 255, 0.98);
}

.upload-dropzone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-preview-grid,
.existing-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.upload-preview-card,
.existing-image-card {
    padding: 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(109, 123, 164, 0.14);
    display: grid;
    gap: 12px;
}

.upload-preview-card img,
.existing-image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 14px;
}

.existing-image-meta {
    display: grid;
    gap: 8px;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.filter-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
}

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

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

.data-table th,
.data-table td {
    text-align: left;
    padding: 16px 14px;
    border-bottom: 1px solid rgba(109, 123, 164, 0.12);
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.product-cell {
    display: flex;
    gap: 16px;
    min-width: 260px;
}

.product-thumb {
    width: 78px;
    height: 78px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(237, 240, 251, 0.9);
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    color: var(--muted);
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pagination {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.page-link {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
}

.page-link.is-active {
    background: linear-gradient(135deg, #5e73ff 0%, #7ab6ff 100%);
    color: #fff;
    border-color: transparent;
}

.empty-state {
    padding: 44px 24px;
    text-align: center;
    border-radius: 22px;
    border: 1px dashed rgba(109, 123, 164, 0.2);
    background: rgba(255, 255, 255, 0.55);
}

.empty-state h4,
.empty-state p {
    margin: 0;
}

.empty-state p {
    margin-top: 10px;
    color: var(--muted);
}

.toast-stack {
    position: fixed;
    top: 20px;
    right: 24px;
    display: grid;
    gap: 12px;
    z-index: 30;
}

.toast {
    min-width: 280px;
    padding: 16px 18px;
    border-radius: 18px;
    box-shadow: var(--shadow);
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toast-success { border-left: 4px solid #67c587; }
.toast-warning { border-left: 4px solid #f0b05d; }
.toast-danger { border-left: 4px solid #d85f73; }
.toast-info { border-left: 4px solid #6e93ff; }

.toast-close {
    border: 0;
    background: transparent;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--muted);
}

.alert {
    padding: 15px 18px;
    border-radius: 18px;
    border: 1px solid transparent;
}

.alert-info {
    background: rgba(168, 216, 234, 0.18);
    border-color: rgba(168, 216, 234, 0.4);
}

.alert-danger {
    background: rgba(248, 181, 197, 0.22);
    border-color: rgba(216, 95, 115, 0.28);
}

.auth-card {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 42px auto;
    padding: 30px;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 28px;
}

.auth-copy {
    padding: 22px;
    display: grid;
    align-content: center;
    gap: 14px;
}

.auth-copy p {
    color: var(--muted);
}

.auth-panel {
    padding: 28px;
}

.guest-shell {
    position: relative;
    z-index: 1;
    padding: 24px;
}

.install-card {
    max-width: 980px;
    margin: 36px auto;
}

.narrow-card {
    max-width: 760px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(38, 48, 74, 0.38);
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal-card {
    width: min(100%, 460px);
    padding: 28px;
    border-radius: 24px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.modal-card h3,
.modal-card p {
    margin-top: 0;
}

code {
    padding: 4px 8px;
    border-radius: 10px;
    background: rgba(233, 237, 255, 0.72);
}

@media (max-width: 1200px) {
    .stats-grid,
    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-two,
    .auth-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .topbar,
    .hero-card,
    .section-heading {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    .app-main,
    .guest-shell {
        padding: 16px;
    }

    .surface-card,
    .hero-card,
    .install-card,
    .auth-card {
        padding: 20px;
    }

    .stats-grid,
    .grid-two-form,
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .product-cell {
        min-width: 220px;
    }

    .toast-stack {
        left: 16px;
        right: 16px;
    }

    .toast {
        min-width: 0;
    }
}
