:root {
    --bg: #ffffff;
    --bg-soft: #f7f8fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #111827;
    --ink-soft: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-soft);
    color: var(--ink);
    font-family: 'Manrope', sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand,
.display-4 {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--ink);
    letter-spacing: -0.02em;
}

a {
    color: var(--primary);
}

a:hover {
    color: var(--primary-strong);
}

/* Bootstrap fallback primitives (used if CDN CSS fails). */
.container,
.container-fluid {
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

.container {
    max-width: 1120px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}

[class^="col-"],
[class*=" col-"] {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    width: 100%;
}

@media (min-width: 768px) {
    .col-md-3 {
        width: 25%;
    }

    .col-md-4 {
        width: 33.333333%;
    }

    .col-md-6 {
        width: 50%;
    }

    .col-md-9 {
        width: 75%;
    }
}

@media (min-width: 992px) {
    .col-lg-5 {
        width: 41.666667%;
    }
}

.justify-content-center {
    justify-content: center;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 0.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 3rem;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.my-4 {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-4 {
    padding: 1.5rem;
}

.py-5 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.w-100 {
    width: 100%;
}

.text-center {
    text-align: center;
}

.text-end {
    text-align: right;
}

.text-muted {
    color: var(--ink-soft) !important;
}

.lead {
    color: var(--ink-soft);
}

.navbar {
    background: #ffffff !important;
    border-bottom: 1px solid var(--line);
}

.navbar-brand {
    font-size: 1.15rem;
    font-weight: 700;
}

.navbar .nav-link {
    color: #374151 !important;
    font-weight: 600;
}

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.card-body {
    padding: 1.25rem;
}

.btn {
    display: inline-block;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    padding: 0.62rem 0.9rem;
    text-decoration: none;
    cursor: pointer;
}

.btn-sm {
    font-size: 0.84rem;
    padding: 0.46rem 0.7rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: var(--primary-strong);
    color: #fff;
}

.btn-outline-secondary {
    border-color: #cbd5e1;
    color: #334155;
    background: #fff;
}

.btn-outline-primary {
    border-color: #93c5fd;
    color: var(--primary);
    background: #fff;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
    background: #f8fafc;
}

.form-label {
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.35rem;
}

.form-control,
.form-select,
textarea.form-control {
    display: block;
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0.62rem 0.75rem;
    background: #fff;
    color: #111827;
}

input.form-control:focus,
textarea.form-control:focus,
select.form-control:focus,
.form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    outline: none;
}

.list-group {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.list-group-item {
    display: block;
    padding: 0.78rem 0.9rem;
    border-bottom: 1px solid var(--line);
    color: #374151;
    text-decoration: none;
    background: #fff;
}

.list-group-item:last-child {
    border-bottom: 0;
}

.list-group-item.active {
    background: #eff6ff;
    color: #1d4ed8;
    border-left: 3px solid #2563eb;
    padding-left: calc(0.9rem - 3px);
}

.jumbotron {
    padding: 2.4rem 1.6rem;
    margin: 2.4rem 0;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
}

.display-4 {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    border-bottom: 1px solid var(--line);
    padding: 0.72rem;
    vertical-align: middle;
}

.table thead th {
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background: #fbfdff;
}

.badge {
    border-radius: 999px;
    padding: 0.35rem 0.58rem;
    font-size: 0.76rem;
    font-weight: 700;
}

.text-bg-success {
    background: #dcfce7;
    color: #166534;
}

.text-bg-warning {
    background: #fff7ed;
    color: #9a3412;
}

.text-bg-secondary {
    background: #f1f5f9;
    color: #334155;
}

.alert {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    background: #fff;
}

.alert-success {
    border-color: #86efac;
    background: #f0fdf4;
}

.alert-danger {
    border-color: #fca5a5;
    background: #fef2f2;
}

.alert-warning {
    border-color: #fcd34d;
    background: #fffbeb;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 2rem 0;
    background: var(--bg-soft);
}

.auth-header {
    color: var(--ink);
}

.auth-kicker {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.auth-title {
    margin-bottom: 0.15rem;
    font-size: clamp(1.8rem, 4vw, 2.3rem);
}

.auth-subtitle {
    color: #64748b;
}

.auth-card {
    border-radius: 16px;
    background: #fff;
}

.auth-form-title {
    font-size: 1.5rem;
}

.auth-link-block a {
    font-weight: 700;
    text-decoration: none;
}

.auth-link-block a:hover {
    text-decoration: underline;
}

.scroll-to-top-btn {
    position: fixed;
    right: 18px;
    bottom: 60px;
    z-index: 1070;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.scroll-to-top-btn.is-visible {
    display: flex;
}

.scroll-to-top-btn:hover {
    background: var(--primary-strong);
    transform: translateY(-2px);
}

.studio-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.studio-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.studio-topbar-left,
.studio-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.studio-brand {
    color: #0f172a;
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.08rem;
}

.studio-menu-toggle {
    display: none;
    width: 2.35rem;
    height: 2.35rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font-size: 1.25rem;
    line-height: 1;
}

.studio-menu-toggle:hover,
.studio-menu-toggle:focus-visible {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.studio-user {
    color: #475569;
    font-weight: 600;
    font-size: 0.92rem;
}

.studio-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.1rem;
    padding: 1.1rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.studio-sidebar {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.7rem;
    box-shadow: var(--shadow);
    height: fit-content;
}

.studio-nav-item {
    display: block;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    color: #334155;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.studio-nav-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.studio-nav-item.active {
    background: #eff6ff;
    color: #1d4ed8;
}

.studio-main {
    min-width: 0;
}

.studio-panel {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 1.2rem;
}

.studio-panel-content {
    padding-top: 0.95rem;
}

.studio-panel-hero {
    padding: 1.6rem;
}

.studio-kicker {
    margin: 0 0 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 700;
}

.studio-title {
    margin: 0;
    font-size: clamp(1.5rem, 2.8vw, 2.2rem);
    line-height: 1.25;
}

.studio-subtitle {
    margin: 0.65rem 0 1.15rem;
    color: #64748b;
}

.studio-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.studio-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.studio-grid .studio-panel h3 {
    margin-top: 0;
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.studio-header-inline {
    margin-bottom: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--line);
}

.media-card {
    overflow: hidden;
}

.product-catalog-card {
    overflow: hidden;
}

.product-catalog-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.product-catalog-image {
    display: flex;
    min-height: 220px;
    max-height: 220px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f5f7fa;
    color: #6b7280;
    text-decoration: none;
}

.product-catalog-image img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.product-catalog-placeholder {
    font-size: 0.875rem;
    font-weight: 600;
}

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

@media (max-width: 991px) {
    .product-catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .product-catalog-grid {
        grid-template-columns: 1fr;
    }
}

.media-preview-btn {
    border: 0;
    background: transparent;
    padding: 0;
    width: 100%;
    cursor: zoom-in;
}

.media-preview-btn .card-img-top {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    display: block;
}

.media-actions {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.media-action-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.media-action-form .form-control {
    min-height: 34px;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.media-action-form .btn {
    white-space: nowrap;
}

.media-gallery-stage {
    min-height: min(70vh, 720px);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #0f172a;
}

.media-gallery-content {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-gallery-content img,
.media-gallery-content video {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.media-gallery-nav {
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    font-size: 1.4rem;
    line-height: 1;
}

.media-gallery-nav:hover,
.media-gallery-nav:focus-visible {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.55);
}

.media-gallery-nav:disabled {
    visibility: hidden;
}

.inventory-product-filter {
    width: min(100%, 320px);
}

.inventory-insights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.inventory-insights > div {
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
}

.inventory-insights span,
.inventory-insights small,
.inventory-offering-metrics span {
    display: block;
    color: #64748b;
    font-size: 0.78rem;
}

.inventory-insights strong {
    display: block;
    margin: 0.15rem 0;
}

.inventory-chart {
    height: 280px;
}

.inventory-offering-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.inventory-offering-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.inventory-offering-image {
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    color: #2563eb;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
}

.inventory-offering-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inventory-offering-body {
    padding: 1rem;
}

.inventory-offering-vendor {
    margin: 0 0 0.15rem;
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.inventory-offering-body h6 {
    margin: 0;
}

.inventory-offering-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.inventory-offering-metrics > div {
    padding: 0.65rem;
    border-radius: 10px;
    background: #f8fafc;
}

.inventory-offering-metrics strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.9rem;
}

@media (min-width: 1100px) {
    .studio-sidebar.collapse:not(.show) {
        display: block;
    }
}

@media (max-width: 1099px) {
    .studio-menu-toggle {
        display: inline-flex;
    }

    .studio-layout {
        grid-template-columns: 1fr;
        padding: 0.9rem;
    }

    .studio-sidebar {
        width: 100%;
    }

    .studio-sidebar.show,
    .studio-sidebar.collapsing {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .auth-page {
        padding: 1.2rem 0;
    }

    .jumbotron {
        padding: 1.7rem 1.1rem;
    }

    .studio-layout {
        padding: 0.8rem;
    }

    .studio-grid {
        grid-template-columns: 1fr;
    }

    .studio-topbar {
        align-items: center;
        gap: 0.55rem;
    }

    .studio-user {
        display: none;
    }

    .media-gallery-stage {
        min-height: 55vh;
        grid-template-columns: 2.25rem minmax(0, 1fr) 2.25rem;
        gap: 0.3rem;
        padding: 0.6rem;
    }

    .media-gallery-nav {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1.1rem;
    }

    .inventory-insights {
        grid-template-columns: 1fr;
    }
}
