:root {
    --font-body: 'DM Sans', sans-serif;
    --font-heading: 'Sora', sans-serif;
    --bg: #F4F5F7;
    --surface: #FFFFFF;
    --surface-soft: #F9FAFB;
    --sidebar: #0F1117;
    --sidebar-muted: #9CA3AF;
    --text: #111827;
    --muted: #6B7280;
    --line: #E5E7EB;
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --danger: #DC2626;
    --danger-hover: #B91C1C;
    --success: #16A34A;
    --success-bg: #DCFCE7;
    --warning-bg: #FEF3C7;
    --warning: #B45309;
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 16px 40px rgba(15, 17, 23, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 264px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    letter-spacing: 0;
}
a { color: var(--primary); text-decoration: none; transition: all 0.2s ease; }
a:hover { color: var(--primary-hover); }

h1, h2, h3 {
    margin: 0;
    font-family: var(--font-heading);
    letter-spacing: 0;
    color: var(--text);
}
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 19px; line-height: 1.25; }
p { margin: 0; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--sidebar);
    color: #fff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    z-index: 30;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 26px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20px;
}
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
}
.nav-label {
    padding: 10px 10px 8px;
    color: var(--sidebar-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: #D1D5DB;
    font-weight: 600;
}
.nav-link:hover, .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}
.nav-link.disabled {
    color: #6B7280;
    cursor: default;
}
.nav-spacer { flex: 1; }

.main {
    width: 100%;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}
.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: rgba(244, 245, 247, 0.9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.mobile-menu {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
}
.page-kicker {
    color: var(--muted);
    font-size: 14px;
    margin-top: 5px;
}
.userbar { display: flex; align-items: center; gap: 14px; }
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #E0E7FF;
    color: var(--primary);
    font-weight: 800;
}
.logout { color: var(--muted); font-weight: 700; }
.logout:hover { color: var(--danger); }
.content { padding: 30px 32px 48px; max-width: 1280px; }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(229, 231, 235, 0.7);
    padding: 24px;
}
.card + .card { margin-top: 20px; }
.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}
.card-title { display: grid; gap: 5px; }
.muted { color: var(--muted); font-size: 14px; }

.btn, button, .button {
    min-height: 40px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn:hover, button:hover, .button:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
}
.btn.secondary, .button.secondary {
    background: #EEF2FF;
    color: var(--primary);
}
.btn.secondary:hover, .button.secondary:hover {
    background: #E0E7FF;
}
.btn.danger, button.danger {
    background: var(--danger);
}
.btn.danger:hover, button.danger:hover {
    background: var(--danger-hover);
}

.alert {
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    background: var(--success-bg);
    color: var(--success);
    font-weight: 700;
}
.alert.error {
    background: #FEE2E2;
    color: var(--danger);
}

.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}
.data-table th {
    padding: 0 16px 12px;
    text-align: left;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.data-table td {
    padding: 16px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}
.data-table tbody tr {
    transition: all 0.2s ease;
}
.data-table tbody tr:hover {
    background: #F9FAFB;
}
.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.table-actions form { margin: 0; }
.store-name { font-weight: 800; }
.url-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 800;
}
.badge.active { background: var(--success-bg); color: var(--success); }
.badge.inactive { background: var(--warning-bg); color: var(--warning); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}
.form-grid .full { grid-column: 1 / -1; }
.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.form-stack { display: grid; gap: 16px; }
label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
    color: #374151;
}
input, textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: 10px 12px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}
textarea {
    min-height: 104px;
    resize: vertical;
}
input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    background: #fff;
}
input:disabled {
    color: var(--muted);
    background: #F3F4F6;
}
.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.check input {
    width: 18px;
    min-height: 18px;
    height: 18px;
    accent-color: var(--primary);
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.dropzone {
    min-height: 170px;
    border: 1px dashed #CBD5E1;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
    background: var(--surface-soft);
    cursor: pointer;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}
.dropzone:hover, .dropzone.dragging {
    border-color: var(--primary);
    background: #EFF6FF;
    color: var(--primary);
}
.dropzone input { display: none; }
.gallery { margin-top: 18px; }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
}
.gallery article {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
}
.gallery img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: #EEF2F7;
}
.gallery p {
    color: var(--muted);
    font-size: 13px;
    min-height: 36px;
    overflow-wrap: anywhere;
}
.gallery-bulk { display: grid; gap: 16px; }
.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}
.image-check {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--muted);
}
.image-check input {
    width: 18px;
    min-height: 18px;
    height: 18px;
    accent-color: var(--primary);
}
.single-delete { width: 100%; }
.empty {
    color: var(--muted);
    padding: 20px 0;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #EFF6FF 0%, #F4F5F7 62%, #FFFFFF 100%);
}
.login-card {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    padding: 34px;
}
.login-brand {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin-bottom: 26px;
    text-align: center;
}
.login-brand .brand-mark {
    width: 48px;
    height: 48px;
}
.login-card form { display: grid; gap: 16px; }

@media (max-width: 900px) {
    .form-grid, .field-grid { grid-template-columns: 1fr; }
    .form-grid .full { grid-column: auto; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .mobile-menu { display: inline-grid; place-items: center; }
    .topbar { padding: 0 18px; }
    .content { padding: 22px 18px 36px; }
    .card { padding: 18px; }
    .card-header { flex-direction: column; align-items: stretch; }
    .userbar span { display: none; }
}
