:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --topbar-height: 60px;
    --body-bg: #f1f5f9;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: #1e293b;
    background: var(--body-bg);
}

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

.validation-summary-valid {
    display: none !important;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 1000;
    overflow-y: auto;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    font-weight: 700;
    font-size: 1.05rem;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--sidebar-active);
    display: grid;
    place-items: center;
}

.sidebar-nav { padding: .75rem 0 1.5rem; }

.sidebar-heading {
    padding: .85rem 1.25rem .35rem;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .65rem 1.25rem;
    color: #94a3b8;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}

.sidebar-link i { width: 18px; text-align: center; }

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(59,130,246,.1);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
}

.admin-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

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

.sidebar-toggle {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: .35rem;
}

.admin-content { padding: 24px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    transition: box-shadow .2s;
}

.stat-card:hover { box-shadow: 0 8px 24px rgba(15,23,42,.08); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.1rem;
}

.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 13px; color: #64748b; margin-bottom: .35rem; }

.badge-status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
}

.card-header {
    background: #fff;
    padding: 16px 20px;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

.table th {
    font-size: 12px;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: .04em;
}

.cell-truncate {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-col { width: 140px; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(15,23,42,.25);
}

.login-card h1 {
    margin: 0 0 .35rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.login-card p {
    margin: 0 0 1.5rem;
    color: #64748b;
}

body.sidebar-collapsed .admin-sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .admin-main { margin-left: 0; }

@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-main { margin-left: 0; }
    body.sidebar-open .admin-sidebar { transform: translateX(0); }
    .admin-content { padding: 16px; }
    .page-header h1 { font-size: 20px; }
}

.form-label { display: block; font-weight: 600; margin-bottom: .35rem; }

.form-control,
.form-select {
    width: 100%;
    padding: .65rem .85rem;
    border: 1px solid #e2e8f0;
    border-radius: .375rem;
    font: inherit;
}

.product-editor .editor-section { margin-bottom: 1rem; }

.product-form { margin-bottom: 2rem; }

.product-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
    background: linear-gradient(to top, var(--body-bg) 70%, transparent);
    border-top: 1px solid #e2e8f0;
}

.upload-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .75rem;
    min-height: 220px;
    padding: 1.25rem;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color .2s, background .2s, box-shadow .2s;
    margin-bottom: 0;
}

.upload-tile:hover,
.upload-tile:focus-within {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.upload-tile-main {
    cursor: default;
    min-height: auto;
}

.upload-tile-main:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    box-shadow: none;
}

.upload-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: #e2e8f0;
    color: #64748b;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
}

.upload-tile-body { width: 100%; }

.upload-tile-body strong {
    display: block;
    font-size: .95rem;
    color: #1e293b;
    margin-bottom: .25rem;
}

.upload-hint {
    display: inline-block;
    margin-top: .5rem;
    font-size: .82rem;
    color: #3b82f6;
    font-weight: 600;
}

.upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.upload-preview {
    width: 100%;
    max-height: 160px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.upload-tile-main .upload-tile-body {
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.gallery-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow .2s;
}

.gallery-card:hover {
    box-shadow: 0 4px 16px rgba(15,23,42,.08);
}

.gallery-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f1f5f9;
}

.gallery-card-placeholder {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 2rem;
}

.gallery-card-body {
    padding: .65rem;
}

.gallery-card-label {
    display: block;
    font-size: .75rem;
    color: #64748b;
    margin-bottom: .5rem;
}

.gallery-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #94a3b8;
}

.gallery-empty i {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    display: block;
}

.gallery-empty p {
    margin: 0;
    font-size: .9rem;
}

.product-thumb-col {
    width: 72px;
}

.product-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    display: block;
}

.product-thumb-empty {
    display: grid;
    place-items: center;
    color: #94a3b8;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .product-form-actions {
        flex-direction: column-reverse;
    }

    .product-form-actions .btn {
        width: 100%;
    }
}
