:root {
    --background: #fcfcfd;
    --foreground: #141923;
    --card: #ffffff;
    --muted: #f5f7fa;
    --muted-foreground: #6b7280;
    --border: #e5e9f0;
    --primary: #1f2937;
    --primary-foreground: #ffffff;
    --sidebar-bg: #151b26;
    --sidebar-fg: #c5cedb;
    --sidebar-active-bg: #222a38;
    --sidebar-border: #242d3d;
    --danger: #dc2626;
    --success: #0f9c57;
    --warning: #f59e0b;
    --radius: 6px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Inter", sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.4;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    background: var(--background);
}

.sidebar {
    width: 224px;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-brand {
    height: 56px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 0 14px;
}

.sidebar-logo {
    width: auto;
    height: 32px;
    background: #0b1220;
    border-radius: 6px;
    padding: 3px 6px;
}

.sidebar-nav {
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.sidebar-link {
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--sidebar-fg);
    transition: background-color .2s ease, color .2s ease;
}

.sidebar-link:hover {
    background: var(--sidebar-active-bg);
    color: #fff;
}

.sidebar-link.is-active {
    background: var(--sidebar-active-bg);
    color: #f8fafc;
}

.sidebar-user {
    border-top: 1px solid var(--sidebar-border);
    padding: 12px;
}

.sidebar-user-name,
.sidebar-user-email {
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-name {
    color: #f8fafc;
    font-weight: 500;
}

.sidebar-user-email {
    color: #9aa6bd;
    margin-top: 2px;
    margin-bottom: 10px;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.mobile-header {
    display: none;
}

.mobile-drawer {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.mobile-drawer.is-open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-drawer-panel {
    width: 224px;
    height: 100%;
    background: var(--sidebar-bg);
    transform: translateX(-100%);
    transition: transform .2s ease;
    display: flex;
    flex-direction: column;
}

.mobile-drawer.is-open .mobile-drawer-panel {
    transform: translateX(0);
}

.page-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.page-header {
    margin-bottom: 16px;
}

.page-header h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 600;
}

.page-header p {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--muted-foreground);
}

.alert {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
}

.alert-success {
    border-color: rgba(15, 156, 87, .3);
    color: #0a7d45;
    background: #effdf5;
}

.alert-error {
    border-color: rgba(220, 38, 38, .3);
    color: #b91c1c;
    background: #fef2f2;
}

.btn {
    border-radius: var(--radius);
    border: 1px solid transparent;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    background: #fff;
    color: var(--foreground);
    transition: background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}

.btn:hover {
    opacity: .95;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn-outline {
    border-color: var(--border);
    background: #fff;
    color: var(--foreground);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--sidebar-fg);
}

.btn-ghost:hover {
    background: var(--sidebar-active-bg);
    color: #fff;
}

.btn-sm {
    font-size: 12px;
    padding: 7px 10px;
}

.full-width {
    width: 100%;
}

.toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.filter-panel,
.table-card,
.form-card,
.detail-card,
.stat-card,
.auth-card,
.empty-state {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.filter-panel,
.form-card,
.detail-card,
.stat-card,
.auth-card,
.empty-state {
    padding: 14px;
}

.table-card {
    overflow: hidden;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
}

.filter-group {
    display: grid;
    gap: 4px;
}

.filter-group label {
    display: grid;
    gap: 4px;
    font-size: 12px;
    color: var(--muted-foreground);
}

.filter-group input,
.filter-group select,
.auth-form input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.export-single select,
label input,
label select,
label textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--foreground);
    background: #fff;
}

label textarea {
    resize: vertical;
}

.filter-actions,
.btn-group,
.form-actions,
.card-actions,
.badge-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-actions {
    justify-content: flex-end;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    color: var(--muted-foreground);
    font-size: 12px;
    font-weight: 500;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-actions {
    white-space: nowrap;
    width: 1%;
}

.inline-form {
    display: inline-block;
    margin-left: 6px;
}

.empty-state {
    color: var(--muted-foreground);
    text-align: center;
}

.auth-form,
.form-grid,
.form-section,
.image-actions,
.file-picker,
.spec-list {
    display: grid;
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    background: #fff;
}

.form-section h3,
.detail-card h2,
.detail-card h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.detail-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-section h4 {
    margin: 10px 0 4px;
    font-size: 11px;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.detail-section p,
.muted {
    margin: 0;
    font-size: 13px;
    color: var(--muted-foreground);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

.status-draft {
    background: #fef3c7;
    color: #92400e;
}

.status-ready {
    background: #dcfce7;
    color: #166534;
}

.status-archived {
    background: #fee2e2;
    color: #991b1b;
}

.badge-wholesale {
    background: #ecfeff;
    color: #155e75;
}

.badge-retail {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-logo-img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.badge-logo-img[src*="bathco-logo"],
.brand-strip-logo[src*="bathco-logo"] {
    background: #000;
    border-radius: 4px;
    padding: 2px;
}

.badge-logo-img[src*="bathx-logo"],
.brand-strip-logo[src*="bathx-logo"] {
    background: #2563eb;
    border-radius: 4px;
    padding: 2px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.stat-label {
    font-size: 12px;
    color: var(--muted-foreground);
}

.stat-value {
    margin-top: 8px;
    font-size: 30px;
    line-height: 1;
    font-weight: 700;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.channel-card {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    background: #fff;
}

.channel-card input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    min-height: 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    margin: 0;
    flex: 0 0 18px !important;
}

.channel-card .badge {
    margin: 0;
    white-space: nowrap;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.spec-row {
    display: grid;
    grid-template-columns: 24px 1fr 1fr auto;
    gap: 8px;
    align-items: center;
}

.spec-order {
    height: 24px;
    width: 24px;
    border-radius: 999px;
    background: var(--muted);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 600;
}

.spec-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.file-picker input[type="file"] {
    display: none;
}

.file-picker-box {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    color: var(--muted-foreground);
    cursor: pointer;
}

.file-picker-box .plus {
    display: inline-grid;
    place-items: center;
    height: 32px;
    width: 32px;
    border-radius: 999px;
    background: var(--muted);
    font-size: 20px;
    margin-bottom: 4px;
}

.image-preview-grid,
.existing-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.image-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    display: grid;
    gap: 8px;
}

.image-card.removed {
    opacity: .55;
    border-color: var(--danger);
}

.image-frame,
.slider-image {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--muted);
    overflow: hidden;
    aspect-ratio: 1/1;
    display: grid;
    place-items: center;
}

.image-card img,
.slider-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-slider {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    gap: 8px;
    align-items: center;
}

.slider-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    gap: 8px;
    overflow-x: auto;
}

.slider-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    background: #fff;
}

.slider-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
}

.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.login-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--muted);
    padding: 16px;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--muted);
}

.login-shell .login-layout {
    flex: 1;
    min-height: auto;
}

.app-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    padding: 9px 14px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.35;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.96) 100%);
    backdrop-filter: blur(1px);
}

.app-footer a {
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    transition: color .2s ease;
}

.app-footer a:hover {
    color: #111827;
}

.app-footer-sep {
    color: #cbd5e1;
}

.app-footer-login {
    background: linear-gradient(180deg, rgba(245, 247, 250, 0.92) 0%, rgba(241, 245, 249, 0.96) 100%);
}

.auth-card {
    width: min(380px, 100%);
}

.auth-card .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    background: #0b1220;
    border-radius: 8px;
    padding: 6px 10px;
    margin-bottom: 12px;
    margin-left: auto;
    margin-right: auto;
}

.auth-card .logo {
    height: 46px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.auth-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--muted-foreground);
    margin: 0 0 10px;
}

.mobile-logo {
    height: 28px;
    width: auto;
    background: #0b1220;
    border-radius: 6px;
    padding: 3px 6px;
}

.mobile-nav-toggle {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    display: grid;
    gap: 4px;
    place-content: center;
    cursor: pointer;
}

.mobile-nav-toggle span {
    width: 14px;
    height: 2px;
    background: #111827;
}

.field-required,
.field-optional {
    font-size: 11px;
}

.field-required {
    color: #b91c1c;
}

.field-optional {
    color: var(--muted-foreground);
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .sidebar {
        display: none;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        gap: 10px;
        height: 56px;
        border-bottom: 1px solid var(--sidebar-border);
        padding: 0 14px;
        background: var(--sidebar-bg);
        transition: background-color .2s ease, border-color .2s ease;
    }

    .page-content {
        padding: 14px;
    }

    .form-row,
    .detail-grid,
    .channel-grid,
    .image-slider,
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .spec-row {
        grid-template-columns: 1fr;
    }

    .spec-row .spec-order,
    .spec-row input,
    .spec-row .spec-controls {
        grid-column: 1 / -1;
    }

    .table-card {
        overflow-x: auto;
    }

    .data-table {
        min-width: 720px;
    }
}

@media (max-width: 820px) {
    .mobile-nav-toggle {
        border-color: var(--sidebar-border);
        background: var(--sidebar-active-bg);
    }

    .mobile-nav-toggle span {
        background: #f8fafc;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-actions,
    .pagination,
    .toolbar,
    .filter-actions {
        justify-content: stretch;
    }

    .form-actions .btn,
    .pagination .btn,
    .toolbar .btn,
    .filter-actions .btn {
        flex: 1;
        text-align: center;
    }

    .app-footer {
        justify-content: center;
        text-align: center;
        font-size: 10.5px;
        padding: 8px 10px;
    }
}

.brand-strip {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.brand-strip-logo {
    height: 20px;
    width: auto;
    opacity: .65;
}

