* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2e8b2e;
    --primary-dark: #1f6e1f;
    --bg: #f5f7f5;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --primary: #4ade80;
    --primary-dark: #22c55e;
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --danger: #f87171;
    --success: #4ade80;
    --warning: #fbbf24;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}
[data-theme="dark"] .table th { background: #1a2332; }
[data-theme="dark"] .table-hover tbody tr:hover { background: #1a2332; }
[data-theme="dark"] .nav-search-input { background: var(--surface); }
[data-theme="dark"] .nav-search-input:focus { background: #0f172a; }
[data-theme="dark"] .product-card-image { background: #1a2332; }
[data-theme="dark"] .product-price-box { background: #1a2332; }
[data-theme="dark"] .status-nowe { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .status-potwierdzone { background: #14432a; color: #6ee7b7; }
[data-theme="dark"] .status-w_realizacji { background: #422006; color: #fcd34d; }
[data-theme="dark"] .status-wyslane { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .status-zrealizowane { background: #14432a; color: #6ee7b7; }
[data-theme="dark"] .status-anulowane { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .status-oczekuje_zatwierdzenia { background: #422006; color: #fcd34d; }
[data-theme="dark"] .status-odrzucone { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .flash-danger { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .flash-success { background: #14432a; color: #6ee7b7; border-color: #166534; }
[data-theme="dark"] .flash-info { background: #14432a; color: #86efac; border-color: #166534; }
[data-theme="dark"] .login-box, [data-theme="dark"] .register-box { box-shadow: 0 4px 24px rgba(0,0,0,0.3); }
[data-theme="dark"] img { opacity: 0.9; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.link { font-weight: 500; }

.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ---- Navbar ---- */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 32px; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-brand { display: flex; align-items: center; text-decoration: none; }
.nav-logo { height: 36px; width: auto; }
.nav-menu { display: flex; gap: 4px; }
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.15s;
}
.nav-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--primary); background: #ecfdf5; font-weight: 500; }
.nav-admin { color: var(--warning); }
.nav-admin.active { background: #fffbeb; }
.nav-user { color: var(--text-muted); font-size: 0.85rem; }
.nav-search { display: flex; position: relative; }
.nav-search-input {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.95rem;
    width: 320px;
    background: var(--bg);
    transition: all 0.25s ease;
}
.nav-search-input:focus { border-color: var(--primary); outline: none; width: 420px; background: var(--surface); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.nav-search-input::placeholder { color: var(--text-muted); }
.badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }

/* ---- Stat Cards ---- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow); text-decoration: none; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }
.stat-warning { border-color: var(--warning); }
.stat-warning .stat-value { color: var(--warning); }

/* ---- Tables ---- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.table th, .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}
.table-hover tbody tr:hover { background: #f8fafc; }
.table-compact th, .table-compact td { padding: 6px 10px; font-size: 0.85rem; }
.table tfoot td { font-weight: 600; background: #f8fafc; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mono { font-family: 'SF Mono', 'Cascadia Code', monospace; font-size: 0.85rem; }

.row-unavailable { opacity: 0.45; background: var(--bg) !important; }
.row-unavailable td { color: var(--text-muted); }
.row-unavailable .product-card-info { color: var(--text-muted); }
.row-unavailable img { filter: grayscale(40%); }
.row-inactive { opacity: 0.5; background: #fafafa; }

.stock-ok { color: var(--success); font-weight: 600; }
.stock-none { color: var(--danger); font-weight: 500; font-size: 0.85rem; }

/* ---- Status Badges ---- */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}
.status-nowe { background: #dbeafe; color: #1d4ed8; }
.status-potwierdzone { background: #d1fae5; color: #065f46; }
.status-w_realizacji { background: #fef3c7; color: #92400e; }
.status-wyslane { background: #e0e7ff; color: #3730a3; }
.status-zrealizowane { background: #d1fae5; color: #065f46; }
.status-anulowane { background: #fee2e2; color: #991b1b; }
.status-oczekuje_zatwierdzenia { background: #fef3c7; color: #92400e; }
.status-odrzucone { background: #fee2e2; color: #991b1b; }

/* ---- Forms ---- */
.form-card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 800px;
}
.form-group { margin-bottom: 16px; flex: 1; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 0.85rem; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; align-items: center; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }

.input-sm {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    width: auto;
}
.input-search {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    flex: 1;
    min-width: 250px;
}
.input-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    resize: vertical;
    margin-bottom: 12px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); opacity: 1; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: #d1fae5; color: #065f46; }
.btn-link { background: none; color: var(--primary); padding: 8px 0; }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; font-weight: 600; }
.btn-full { width: 100%; }

/* ---- Filters ---- */
.filters { margin-bottom: 20px; }
.filter-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-row select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--surface);
}
.filter-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.filter-check input[type="checkbox"] { width: auto; }

/* ---- Slider ---- */
.slider {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.slider-track {
    display: flex;
    transition: transform 0.5s ease;
}
.slider-slide {
    min-width: 100%;
    position: relative;
}
.slider-slide img {
    width: 100%;
    height: auto;
    display: block;
}
.slider-slide a { text-decoration: none; }
.slider-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 40px 28px 20px;
    color: #fff;
}
.slider-caption h2 { font-size: 1.4rem; margin-bottom: 4px; }
.slider-caption p { font-size: 0.95rem; opacity: 0.9; }
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
}
.slider-btn:hover { background: #fff; }
.slider-prev { left: 12px; }
.slider-next { right: 12px; }
.slider-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}
.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.2s;
}
.slider-dot.active { background: #fff; }

/* ---- Product Grid (nowości) ---- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, transform 0.2s;
}
.product-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateY(-2px); text-decoration: none; }
.product-card-image {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    overflow: hidden;
}
.product-card-image img { max-height: 100%; max-width: 100%; object-fit: contain; padding: 8px; }
.product-card-noimg {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-muted);
    opacity: 0.3;
}
.product-card-info { padding: 12px; }
.product-card-index { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }
.product-card-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 4px 0 8px;
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
}
.product-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-card-price { font-weight: 700; color: var(--primary); font-size: 0.95rem; }

@media (max-width: 1024px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .slider-slide img { height: auto; }
    .slider-caption { padding: 20px 16px 12px; }
    .slider-caption h2 { font-size: 1.1rem; }
}

/* ---- Product Detail ---- */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}
.product-image-large {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}
.product-image-large img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    padding: 16px;
}
.product-image-placeholder {
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 80px 20px;
    text-align: center;
}
.product-info {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 28px;
}
.product-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}
.product-category-badge {
    background: #eff6ff;
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}
.product-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}
.product-desc {
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}
.product-price-box {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}
.product-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}
.product-price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}
.product-thresholds { margin-top: 8px; }
.threshold-row { font-size: 0.85rem; padding: 2px 0; }
.product-specs { margin-bottom: 20px; }
.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.spec-label { color: var(--text-muted); }
.product-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.input-qty-large {
    width: 100px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.1rem;
    text-align: center;
}

@media (max-width: 768px) {
    .product-detail-grid { grid-template-columns: 1fr; }
    .product-image-large { min-height: 200px; }
}

/* ---- Catalog Layout (sidebar + content) ---- */
.catalog-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
}
.catalog-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    position: sticky;
    top: 72px;
}
.sidebar-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.category-list li { margin-bottom: 2px; }
.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s;
}
.category-link:hover { background: var(--bg); text-decoration: none; }
.category-link.active { background: #eff6ff; color: var(--primary); font-weight: 600; }
.category-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 8px;
    border-radius: 10px;
}
.category-link.active .category-count { background: #dbeafe; color: var(--primary); }
.category-sublist {
    list-style: none;
    padding: 0 0 0 16px;
    margin: 0;
}
.category-sublist .category-link {
    font-size: 0.85rem;
    padding: 6px 12px;
}
.sidebar-filter {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.catalog-content { min-width: 0; }

/* ---- Cart ---- */
.cart-inline { display: flex; gap: 6px; align-items: center; }
.cart-actions { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.import-row { display: flex; gap: 12px; align-items: center; }

/* ---- Quick Order ---- */
.quick-order-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.tab {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--bg);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-muted);
}
.tab.active { background: var(--surface); border-bottom-color: var(--surface); color: var(--primary); font-weight: 500; }
.tab-content { display: none; background: var(--surface); padding: 20px; border: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) var(--radius); }
.tab-content.active { display: block; }

.search-box { position: relative; margin-bottom: 20px; }
.search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
}
.search-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.search-item:hover { background: #f8fafc; }
.search-item.muted { cursor: default; color: var(--text-muted); }
.search-meta { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ---- Order Info ---- */
.order-info {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.order-notes { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.order-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.admin-status-change { margin-left: auto; }

/* ---- Sections ---- */
.section { margin-top: 32px; }
.section h2, .section h3 { margin-bottom: 12px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

.quick-actions { display: flex; gap: 12px; margin-bottom: 32px; }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state p { margin-bottom: 16px; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 20px; }
.pagination-info { font-size: 0.9rem; color: var(--text-muted); }

/* ---- Flash ---- */
.flash-messages { margin-bottom: 16px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 0.9rem;
    transition: opacity 0.3s;
}
.flash-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.flash-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.flash-info { background: #eff6ff; color: var(--primary); border: 1px solid #bfdbfe; }

/* ---- Login ---- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: var(--surface);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
}
.login-box h1 { text-align: center; color: var(--primary); margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 24px; }
.register-box {
    background: var(--surface);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 560px;
}
.register-box h1 { text-align: center; color: var(--primary); margin-bottom: 4px; }

/* ---- Error page ---- */
.error-page { text-align: center; padding: 80px 0; }
.error-page h1 { font-size: 4rem; color: var(--text-muted); }
.error-page h2 { margin-bottom: 8px; }
.error-page p { color: var(--text-muted); margin-bottom: 24px; }

/* ---- Newsletter Preview ---- */
.newsletter-preview {
    max-width: 600px;
    margin: 16px 0;
    box-shadow: var(--shadow);
    border-radius: 8px;
    overflow: hidden;
}

/* ---- Impersonate Bar ---- */
.impersonate-bar {
    background: #fef3c7;
    color: #92400e;
    padding: 8px 24px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    border-bottom: 2px solid #f59e0b;
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-content {
    background: var(--surface);
    border-radius: 12px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.modal-content h3 { margin-bottom: 12px; }

/* ---- Product Images ---- */
.product-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.product-thumb-empty {
    width: 52px;
    height: 52px;
    background: var(--bg);
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* ---- Sort indicators ---- */
th.sort-asc::after { content: ' ▲'; font-size: 0.7rem; }
th.sort-desc::after { content: ' ▼'; font-size: 0.7rem; }
.table-sortable th { cursor: pointer; user-select: none; }
.table-sortable th:hover { color: var(--primary); }

/* ---- Report grid ---- */
.report-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }

/* ---- View Toggle ---- */
.view-toggle { display: flex; gap: 2px; margin-left: auto; }
.view-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 6px 10px;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all 0.15s;
    line-height: 1;
}
.view-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.view-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.view-btn:hover:not(.active) { background: var(--border); }

/* ---- Theme Toggle ---- */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.theme-toggle:hover { color: var(--text); background: var(--bg); }

/* ---- Breadcrumbs ---- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumb-sep { color: var(--border); font-size: 0.8rem; }
.breadcrumb-current { color: var(--text); font-weight: 500; }

/* ---- Variants ---- */
.variant-selector { margin-bottom: 16px; }
.variant-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.variant-btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s;
}
.variant-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.variant-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.variant-btn.active:hover { opacity: 0.9; }
.variant-btn.variant-unavailable { opacity: 0.4; }
.variant-btn.variant-unavailable:not(.active):hover { border-color: var(--text-muted); color: var(--text-muted); }

/* ---- Favorites ---- */
.btn-fav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--border);
    padding: 2px;
    line-height: 1;
    transition: color 0.15s, transform 0.15s;
}
.btn-fav:hover { color: var(--warning); transform: scale(1.2); }
.btn-fav.active { color: var(--warning); }
.btn-fav-lg { font-size: 1.6rem; }

/* ---- Notifications ---- */
.notif-wrapper { position: relative; }
.notif-bell {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius);
    position: relative;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}
.notif-bell:hover { color: var(--text); background: var(--bg); }
.notif-badge {
    position: absolute;
    top: 0;
    right: -2px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 150;
    overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.notif-mark-all {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list {
    overflow-y: auto;
    max-height: 380px;
}
.notif-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    color: inherit;
}
.notif-item:hover { background: #f8fafc; text-decoration: none; }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #dbeafe; }
.notif-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.notif-item.unread .notif-item-title::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}
.notif-item-text { font-size: 0.8rem; color: var(--text-muted); }
.notif-item-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.notif-icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-right: 10px;
    float: left;
}
.notif-icon-zamowienie { background: #dbeafe; color: #1d4ed8; }
.notif-icon-oferta { background: #d1fae5; color: #065f46; }
.notif-icon-produkt { background: #fef3c7; color: #92400e; }
.notif-icon-system { background: var(--bg); color: var(--text-muted); }
.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---- Mobile menu ---- */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .nav-search-input { width: 220px; }
    .nav-search-input:focus { width: 280px; }
}

@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 16px;
        gap: 8px;
    }
    .nav-left { width: 100%; justify-content: space-between; gap: 8px; }
    .nav-right { width: 100%; justify-content: space-between; }
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0;
        padding: 8px 0;
        border-top: 1px solid var(--border);
    }
    .nav-menu.nav-open { display: flex; }
    .nav-link { padding: 8px 0; }
    .menu-toggle { display: block; }
    .nav-search { order: -1; width: 100%; }
    .nav-search-input { width: 100%; }
    .nav-search-input:focus { width: 100%; }
    .container { padding: 16px; }
    .filter-row { flex-direction: column; }
    .form-row { flex-direction: column; }
    .form-inline { flex-direction: column; align-items: stretch; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .quick-actions { flex-wrap: wrap; }
    .order-actions { flex-direction: column; align-items: flex-start; }
    .admin-nav { flex-wrap: wrap; }
    .cart-actions { flex-direction: column; align-items: stretch; }
    .catalog-layout { grid-template-columns: 1fr; }
    .catalog-sidebar { position: static; }
    .cart-inline { flex-direction: column; gap: 4px; }
    .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table th, .table td { padding: 6px 8px; font-size: 0.8rem; white-space: nowrap; }
    .impersonate-bar { flex-wrap: wrap; font-size: 0.8rem; padding: 6px 16px; }
    .modal-content { padding: 20px; margin: 16px; }
    .info-grid { grid-template-columns: 1fr; }
    .notif-dropdown { width: calc(100vw - 32px); right: -60px; }
    .footer-content { flex-direction: column; gap: 24px; }
}

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 48px; padding: 40px 0 0; }
.footer-content { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; gap: 48px; }
.footer-brand { flex: 1.2; }
.footer-logo { height: 32px; width: auto; margin-bottom: 12px; opacity: 0.8; }
.footer-company { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.footer-contact { font-size: 0.85rem; color: var(--text-muted); }
.footer-social { display: flex; gap: 12px; margin-top: 16px; }
.social-link { color: var(--text-muted); transition: color 0.2s; }
.social-link:hover { color: var(--primary); }
.social-link[title="Instagram"]:hover { color: #E1306C; }
.social-link[title="Facebook"]:hover { color: #1877F2; }
.footer-links { flex: 1; }
.footer-heading { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 12px; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: var(--text); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom { text-align: center; padding: 20px 24px; margin-top: 32px; border-top: 1px solid var(--border); }
.footer-bottom p { font-size: 0.8rem; color: var(--text-muted); }

/* CMS page */
.cms-page { max-width: 800px; margin: 0 auto; padding: 24px 0; }
.cms-page h1 { margin-bottom: 24px; }
.cms-page .cms-content { line-height: 1.8; color: var(--text); }
.cms-content h2 { margin: 24px 0 12px; }
.cms-content h3 { margin: 20px 0 8px; }
.cms-content p { margin-bottom: 12px; }
.cms-content ul, .cms-content ol { margin: 12px 0; padding-left: 24px; }
.cms-content a { color: var(--primary); }

/* Share button */
.share-wrapper { position: relative; }
.btn-share { background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; color: var(--text-muted); transition: all 0.2s; display: flex; align-items: center; }
.btn-share:hover { color: var(--primary); border-color: var(--primary); }
.share-dropdown { display: none; position: absolute; top: 100%; left: 0; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 100; min-width: 180px; overflow: hidden; }
.share-dropdown.open { display: block; }
.share-option { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--text); text-decoration: none; font-size: 0.9rem; transition: background 0.15s; border: none; background: none; width: 100%; cursor: pointer; }
.share-option:hover { background: var(--bg); }
.share-whatsapp:hover { color: #25D366; }
.share-facebook:hover { color: #1877F2; }
.share-email:hover { color: var(--primary); }
.share-copy:hover { color: var(--success); }

/* Free shipping bar */
.free-shipping-bar { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; margin: 16px 0; overflow: hidden; }
.free-shipping-progress { position: absolute; top: 0; left: 0; height: 100%; background: rgba(46,139,46,0.08); border-radius: var(--radius); transition: width 0.5s ease; }
.free-shipping-done .free-shipping-progress { background: rgba(34,197,94,0.12); }
.free-shipping-text { position: relative; z-index: 1; font-size: 0.9rem; color: var(--text); }
.free-shipping-done .free-shipping-text { color: var(--success); font-weight: 500; }

/* Shipping toast notification */
.shipping-toast { position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 24px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); font-size: 0.9rem; color: var(--text); z-index: 9999; transition: bottom 0.4s ease; white-space: nowrap; }
.shipping-toast.show { bottom: 24px; }
.shipping-toast-free { border-color: var(--success); color: var(--success); font-weight: 600; }

/* Floating cart */
.floating-cart { position: fixed; right: 20px; top: 50%; transform: translateY(-50%); z-index: 999; width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.2); text-decoration: none; transition: all 0.2s; }
.floating-cart:hover { background: var(--primary-dark); transform: translateY(-50%) scale(1.1); }
.floating-cart-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 0.7rem; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* Cookie banner */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 16px 24px; z-index: 9998; box-shadow: 0 -4px 16px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cookie-banner p { font-size: 0.85rem; color: var(--text); margin: 0; flex: 1; min-width: 200px; }
.cookie-banner a { color: var(--primary); }
.cookie-banner .btn { white-space: nowrap; }

/* Mediapack */
.mediapack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.media-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow 0.2s; }
.media-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.media-card-preview { height: 180px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-card-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-card-icon { text-align: center; color: var(--text-muted); }
.media-card-icon span { display: block; margin-top: 6px; font-size: 0.8rem; font-weight: 600; }
.media-card-info { padding: 14px; }
.media-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
