:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e2e4e9;
    --text: #1f2430;
    --text-muted: #6b7280;
    --primary: #2b5fd9;
    --primary-dark: #1e46ab;
    --danger: #d63b3b;
    --success: #1f9d55;
    --warning: #b8860b;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: #001340;;
    color: #cfd3dc;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: nowrap;
    transition: width .4s cubic-bezier(.65,0,.35,1), padding .4s cubic-bezier(.65,0,.35,1), opacity .3s ease;
    /* Pinned to the viewport - without this, a flex sibling (.main) taller than the
       screen (long product tables, the shop filters column) stretches .sidebar to
       match it, and the toggle button at its bottom ends up far below the fold. */
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
}

html.layout-modern .sidebar {
    width: 0;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
}

.sidebar .brand {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 0 20px 20px;
    display: block;
    border-bottom: 1px solid #2a2e38;
    margin-bottom: 12px;
}

.sidebar nav a {
    display: block;
    padding: 10px 20px;
    color: #cfd3dc;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background: #262b36;
    color: #fff;
    text-decoration: none;
}

/* --- Sidebar accordion groups (e.g. "Vzhľad" > "Swiper – Homepage") --- */
.nav-group-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    font: inherit;
    color: #cfd3dc;
    cursor: pointer;
    text-align: left;
}
.nav-group-toggle:hover, .nav-group-toggle.active { background: #262b36; color: #fff; }
.nav-group-toggle .nav-chevron {
    margin-left: auto;
    font-size: 15px;
    line-height: 1;
    transition: transform .2s ease;
}
.nav-group.is-open .nav-group-toggle .nav-chevron { transform: rotate(90deg); }

.nav-group-children {
    display: grid;
    grid-template-rows: 0fr;
    margin-left: 20px;
    border-left: 1px solid #2a2e38;
    transition: grid-template-rows .2s ease;
}
.nav-group-children-inner { overflow: hidden; min-height: 0; }
.nav-group.is-open .nav-group-children { grid-template-rows: 1fr; }
.nav-group-children a {
    display: block;
    padding: 8px 16px 8px 22px;
    font-size: 13px;
    color: #cfd3dc;
    position: relative;
}
.nav-group-children a::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    width: 8px;
    height: 1px;
    background: #4a4f5c;
}
.nav-group-children a:hover, .nav-group-children a.active {
    background: #262b36;
    color: #fff;
    text-decoration: none;
}

.sidebar .user-box {
    padding: 14px 20px;
    border-top: 1px solid #2a2e38;
    margin-top: 12px;
    font-size: 13px;
}

.sidebar-modern-toggle {
    margin: auto 16px 16px;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid #2a2e38;
    background: #1e222c;
    color: #cfd3dc;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
}
.sidebar-modern-toggle:hover { background: #262b36; color: #fff; }

/* --- Modern (macOS-style) bottom dock, toggled via the sidebar button --- */
.dock {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translate(-50%, 150%);
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(23, 26, 33, .82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    box-shadow: 0 14px 40px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06);
    z-index: 1000;
    transition: transform .5s cubic-bezier(.34,1.56,.64,1);
    pointer-events: none;
}
html.layout-modern .dock { transform: translate(-50%, 0); pointer-events: auto; }

.dock-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: rgba(255,255,255,.07);
    border: none;
    font-size: 22px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    color: #fff;
    opacity: 0;
    transform: translateY(14px) scale(.9);
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), background .18s ease, opacity .35s ease, transform .35s ease;
}
html.layout-modern .dock-icon { opacity: 1; transform: translateY(0) scale(1); }
.dock-icon:nth-child(1) { transition-delay: .03s; }
.dock-icon:nth-child(2) { transition-delay: .06s; }
.dock-icon:nth-child(3) { transition-delay: .09s; }
.dock-icon:nth-child(4) { transition-delay: .12s; }
.dock-icon:nth-child(5) { transition-delay: .15s; }
.dock-icon:nth-child(6) { transition-delay: .18s; }
.dock-icon:nth-child(7) { transition-delay: .21s; }
.dock-icon:nth-child(8) { transition-delay: .24s; }

.dock-icon:hover { background: rgba(255,255,255,.18); transform: translateY(-10px) scale(1.18); }
.dock-icon.active { background: rgba(255,255,255,.24); }

.dock-icon::after {
    content: attr(data-label);
    position: absolute;
    bottom: 58px;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1f2430;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}
.dock-icon:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

.dock-divider { width: 1px; height: 32px; align-self: center; background: rgba(255,255,255,.18); margin: 0 2px; }

.main { flex: 1; min-width: 0; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content { padding: 24px; }

h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 20px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    animation: couponIn .35s cubic-bezier(.22,.61,.36,1) both;
    transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(20,24,33,.08); }

.stat-card-icon {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    border-radius: 9px;
    margin-bottom: 12px;
}
.stat-card.is-blue .stat-card-icon { background: #e8eefc; }
.stat-card.is-green .stat-card-icon { background: #e6f6ec; }
.stat-card.is-violet .stat-card-icon { background: #efe9fc; }

.stat-card .value { font-size: 24px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.stat-card .label { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.stat-card .sublabel { color: var(--text-muted); font-size: 11px; margin-top: 6px; }

/* --- Dashboard sales chart, compact --- */
.chart-card { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.chart-hero { flex-shrink: 0; min-width: 140px; }
.chart-hero .hero-value { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.chart-hero .hero-label { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.chart-hero .hero-sub { color: var(--text-muted); font-size: 11.5px; margin-top: 10px; }
.chart-plot { flex: 1; min-width: 260px; }
/* Sales chart: fixed-height plot; on phones wider than the screen, scrolled sideways. */
.chart-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.chart-scroll-inner { position: relative; height: 220px; min-width: 100%; }
@media (max-width: 768px) {
    .chart-scroll-inner { width: calc(var(--chart-points, 30) * 32px); }
}

/* --- Top-sellers ranked list --- */
.top-list { display: flex; flex-direction: column; }
.top-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    animation: couponIn .3s ease both;
}
.top-row:last-child { border-bottom: none; }
.top-row:hover { background: #fafbfc; }
.top-rank {
    flex-shrink: 0;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    background: #eef0f4; color: var(--text-muted);
}
.top-rank.is-1 { background: #fde68a; color: #7c5a00; }
.top-rank.is-2 { background: #e2e5ea; color: #4b5361; }
.top-rank.is-3 { background: #f2cba3; color: #7a4414; }
.top-info { flex: 1; min-width: 0; }
.top-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-bar-track { height: 5px; border-radius: 100px; background: #eef0f4; margin-top: 6px; overflow: hidden; }
.top-bar-fill { height: 100%; border-radius: 100px; background: var(--primary); }
.top-figures { flex-shrink: 0; text-align: right; font-size: 12.5px; }
.top-figures .qty { font-weight: 700; }
.top-figures .revenue { color: var(--text-muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafbfc; }

.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #f0f1f3; }
.thumb-lg { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); background: #f0f1f3; }

.gallery-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.gallery-item {
    position: relative;
    width: 150px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: #fafbfc;
}
.gallery-item.is-featured { border-color: var(--primary); }
.gallery-item img {
    width: 100%;
    height: 132px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    display: block;
}
.gallery-item .gallery-tag { position: absolute; top: 12px; left: 12px; }
.gallery-item-actions { display: flex; gap: 6px; margin-top: 8px; }
.gallery-item-actions .btn { flex: 1; text-align: center; padding: 4px 6px; }
.gallery-item .gallery-del { margin-top: 8px; width: 100%; }
.gallery-item.sortable-ghost { opacity: .4; }
#gallery-sortable .gallery-item { cursor: grab; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    background: #eef0f4;
    color: var(--text-muted);
}
.badge.green { background: #e6f6ec; color: var(--success); }
.badge.red { background: #fbe9e9; color: var(--danger); }
.badge.yellow { background: #fbf2df; color: var(--warning); }
.badge.blue { background: #e8eefc; color: var(--primary); }

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    background: #e8eefc;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}
.filter-chip:hover { background: #d9e3fb; }
.filter-chip span { font-weight: 700; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { background: #f1f2f5; text-decoration: none; color: red; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
   
}

form.inline { display: inline; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

input[type=text]:disabled, input[type=email]:disabled, input[type=password]:disabled, input[type=number]:disabled, select:disabled, textarea:disabled {
    background: #eef0f3;
    color: #9199a6;
    cursor: not-allowed;
}

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.wh-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.wh-card {
    width: 108px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: #fafbfc;
}
.wh-card .wh-label { font-size: 12px; font-weight: 600; margin-bottom: 6px; display: block; }
.wh-card .wh-qty {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
    font-weight: 600;
}
.wh-card .wh-pos-wrap { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.wh-card .wh-pos-label { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); display: block; margin-bottom: 3px; }
.wh-card .wh-pos {
    width: 100%;
    padding: 5px 6px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}
.wh-card .wh-pos:focus, .wh-card .wh-qty:focus { color: var(--text); outline: 1px solid var(--primary); }
.wh-card.wh-readonly { background: #eef0f4; }
.wh-card.wh-readonly .wh-qty { background: #eef0f4; color: var(--text-muted); }

.shop-layout { display: flex; gap: 24px; align-items: flex-start; }
.shop-filters {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    top: 16px;
}
.filter-group { margin: 14px 0; }
.filter-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin: 0 0 8px; }
.filter-scroll { max-height: 160px; overflow-y: auto; padding-right: 4px; }
.filter-group .checkbox-row { margin-bottom: 5px; }
.filter-group .checkbox-row span { font-size: 13px; }
.filter-group .checkbox-row.is-disabled { opacity: .45; }
.filter-group .checkbox-row.is-disabled input { cursor: not-allowed; }

.shop-main { flex: 1; min-width: 0; }

.shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.shop-sort { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.shop-sort select { width: auto; padding: 6px 8px; font-size: 13px; }

.shop-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
@media (max-width: 1100px) { .shop-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) { .shop-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .shop-grid { grid-template-columns: 1fr; } }

.shop-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    color: var(--text);
}
.shop-card:hover { border-color: var(--primary); text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.shop-card-image { position: relative; aspect-ratio: 1 / 1; background: #f2f3f5; }
.shop-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-card-sale-badge {
    position: absolute; top: 10px; left: 10px;
    background: var(--danger); color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 3px 8px; border-radius: 100px;
}
.shop-card-info { padding: 12px 14px 16px; }
.shop-card-brand { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 4px; }
.shop-card-title { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; line-height: 1.3; }
.shop-card-price { font-size: 15px; font-weight: 700; }
.shop-card-price .was { font-weight: 500; color: var(--text-muted); text-decoration: line-through; margin-right: 6px; }

.stock-btn { cursor: pointer; border: none; font-family: inherit; }
.stock-btn:hover { filter: brightness(0.95); }

dialog.stock-modal {
    border: none;
    border-radius: var(--radius);
    padding: 0;
    max-width: 90vw;
    width: 720px;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
dialog.stock-modal::backdrop { background: rgba(15,17,23,.55); }
.stock-modal-inner { padding: 20px; max-height: 80vh; overflow-y: auto; }

.stock-qty-in { color: var(--success); font-weight: 600; }
.stock-qty-out { color: var(--danger); font-weight: 600; }

.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    margin-top: 14px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width .25s ease;
}

.cat-current { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.cat-editor summary { margin-bottom: 8px; }

.cat-tree {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
}
.cat-row { padding: 3px 0; }
.cat-row .checkbox-row { gap: 6px; }
.cat-row .checkbox-row span { font-size: 14px; }

.filters { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #e6f6ec; color: var(--success); border: 1px solid #bfe7cd; }
.alert-error { background: #fbe9e9; color: var(--danger); border: 1px solid #f2c2c2; }

.errors { margin: 0 0 16px; padding: 10px 14px; background: #fbe9e9; color: var(--danger); border: 1px solid #f2c2c2; border-radius: 6px; }
.errors ul { margin: 0; padding-left: 18px; }

.pagination { margin-top: 16px; }
.pagination nav { display: flex; gap: 4px; flex-wrap: wrap; }

.permission-group { margin-bottom: 14px; }
.permission-group h3 { font-size: 13px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 8px; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}
.login-box h1 { text-align: center; margin-bottom: 24px; }

.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; }

.order-notes-toggle summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    list-style: none;
}
.order-notes-toggle summary::-webkit-details-marker { display: none; }
.order-notes-toggle summary::before { content: '▸ '; }
.order-notes-toggle[open] summary::before { content: '▾ '; }

.order-notes-list { max-height: 440px; overflow-y: auto; margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.order-note {
    padding: 10px 14px;
    border-radius: 10px;
    background: #eef0f4;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    max-width: 92%;
}
.order-note.is-system { background: #f4f5f7; border: 1px dashed var(--border); }
.order-note.is-user { background: #e8eefc; align-self: flex-end; }
.order-note .order-note-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: 700; display: flex; justify-content: space-between; gap: 10px; }
.order-note .order-note-meta .order-note-author { color: var(--text); }
.order-note .order-note-content { font-size: 13px; line-height: 1.5; word-break: break-word; }
.order-note .order-note-content p { margin: 0 0 8px; }
.order-note .order-note-content p:last-child { margin-bottom: 0; }

/* --- Coupons: ticket-style cards --- */
@keyframes couponIn {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes couponPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(31,157,85,.35); }
    50% { box-shadow: 0 0 0 6px rgba(31,157,85,0); }
}

.coupon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 4px; }

.coupon-card {
    position: relative;
    display: flex;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(20, 24, 33, .06);
    overflow: hidden;
    animation: couponIn .4s cubic-bezier(.22,.61,.36,1) both;
    transition: transform .2s ease, box-shadow .2s ease;
}
.coupon-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(20, 24, 33, .12); }

.coupon-amount {
    flex-shrink: 0;
    width: 118px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 18px 8px;
    color: #fff;
    text-align: center;
}
.coupon-amount.is-percent { background: linear-gradient(160deg, #8b7cf6, #5b4fd1); }
.coupon-amount.is-fixed { background: linear-gradient(160deg, #2fd08a, #0ea968); }
.coupon-amount-value { font-size: 26px; font-weight: 800; line-height: 1; }
.coupon-amount-unit { font-size: 13px; font-weight: 600; opacity: .9; }
.coupon-amount-icon { font-size: 15px; margin-top: 4px; opacity: .85; }

.coupon-divider {
    position: relative;
    border-left: 2px dashed rgba(20, 24, 33, .12);
}
.coupon-notch {
    position: absolute;
    left: -9px;
    width: 18px;
    height: 18px;
    background: var(--bg);
    border-radius: 50%;
    z-index: 1;
}
.coupon-notch-top { top: -9px; }
.coupon-notch-bottom { bottom: -9px; }

.coupon-body { flex: 1; min-width: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.coupon-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .02em;
    word-break: break-all;
}
.coupon-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.coupon-meta-row .badge.valid-pulse { animation: couponPulse 2.2s ease-in-out infinite; }

.coupon-usage { display: flex; flex-direction: column; gap: 4px; }
.coupon-usage-bar { width: 100%; height: 6px; border-radius: 100px; background: #eef0f4; overflow: hidden; }
.coupon-usage-fill { height: 100%; border-radius: 100px; background: var(--success); transition: width .3s ease; }
.coupon-usage-fill.is-warm { background: var(--warning); }
.coupon-usage-fill.is-hot { background: var(--danger); }

.coupon-actions { display: flex; gap: 8px; margin-top: auto; }

.coupon-preview-wrap { margin-bottom: 22px; }
.coupon-preview-wrap .coupon-card { max-width: 360px; }

/* --- Exporty hub --- */
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-top: 4px; }

.export-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 20px;
    color: var(--text);
    animation: couponIn .4s cubic-bezier(.22,.61,.36,1) both;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.export-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(20,24,33,.12); border-color: var(--primary); text-decoration: none; }
.export-card-icon {
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    border-radius: 12px;
    background: linear-gradient(160deg, #e8eefc, #d7e2fb);
    margin-bottom: 14px;
}
.export-card h3 { margin: 0 0 6px; font-size: 15px; }
.export-card p { margin: 0; font-size: 13px; color: var(--text-muted); }

.export-card.is-placeholder { opacity: .55; cursor: default; }
.export-card.is-placeholder:hover { transform: none; box-shadow: none; border-color: var(--border); }

/* --- CSV export tool --- */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab-btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.export-tab { animation: couponIn .3s ease both; }

.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; }
.col-grid.col-grid-meta { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; background: #fafbfc; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.col-grid .checkbox-row { min-width: 0; align-items: flex-start; }
.col-grid .checkbox-row input { flex: none; margin-top: 3px; }
.col-grid .checkbox-row span { font-size: 13px; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.col-grid .checkbox-row.is-locked { opacity: .8; }
.col-grid .checkbox-row.is-locked span { color: var(--text-muted); font-weight: 600; }

/* --- Orders list toolbar: column settings + bulk actions --- */
.list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    min-height: 34px;
}

.bulk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: #eef3ff;
    border: 1px solid #c9d8fb;
    border-radius: 8px;
    animation: couponIn .2s ease both;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-count { font-size: 13px; }
.bulk-bar .bulk-arrow { color: var(--text-muted); }
.bulk-bar select { width: auto; font-size: 13px; padding: 5px 8px; }

.column-settings { position: relative; margin-left: auto; }

.column-settings-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(20,24,33,.14);
    padding: 14px;
}
.column-settings-panel[hidden] { display: none; }
.column-settings-hint { margin: 0 0 10px; font-size: 12px; color: var(--text-muted); }

.column-settings-list { list-style: none; margin: 0 0 12px; padding: 0; }
.column-settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 7px;
}
.column-settings-row:hover { background: #fafbfc; border-color: var(--border); }
.column-settings-row.is-dragging { opacity: .4; }
.column-settings-row.is-locked { opacity: .75; }
.column-settings-row .checkbox-row { flex: 1; gap: 8px; }
.column-settings-row .checkbox-row span { font-size: 13px; }
.column-settings-row .drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 13px;
    user-select: none;
    line-height: 1;
}
.column-settings-row.is-locked .drag-handle { cursor: not-allowed; visibility: hidden; }
.column-settings-actions { display: flex; gap: 8px; }

th.col-check, td.col-check { width: 34px; text-align: center; padding-left: 8px; padding-right: 8px; }
th.col-check input, td.col-check input { width: auto; cursor: pointer; }

/* --- Order detail: carrier / label actions --- */
.carrier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.carrier-box { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; background: #fafbfc; }
.carrier-box-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.carrier-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.carrier-actions form { display: inline; }

/* --- Claude photo finder modal --- */
.claude-photo-grid { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.claude-photo-item {
    position: relative;
    width: 130px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: #fafbfc;
    cursor: grab;
}
.claude-photo-item img { width: 100%; height: 110px; object-fit: contain; border-radius: 6px; background: #fff; display: block; }
.claude-photo-item.sortable-ghost { opacity: .4; }
.claude-photo-position {
    position: absolute; top: 4px; left: 4px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #1f2430; color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.claude-photo-badge { position: absolute; top: 4px; right: 26px; }
.claude-photo-remove {
    position: absolute; top: 2px; right: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    border: none; background: rgba(214,59,59,.9); color: #fff;
    font-size: 13px; line-height: 1; cursor: pointer;
}
.claude-spinner { display: flex; align-items: center; gap: 10px; padding: 20px 0; color: var(--text-muted); }
.claude-spinner .spinner-icon { animation: claudeSpin 1s linear infinite; }
@keyframes claudeSpin { to { transform: rotate(360deg); } }

/* --- toast notice --- */
.toast-notice {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1d2327;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .25s ease, transform .25s ease;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast-notice.visible { opacity: 1; transform: translateY(0); }

/* --- customer message thread (Vrátky/Reklamácie) --- */
.message-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 4px; }
.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.message-bubble--inbound { background: var(--surface); align-self: flex-start; }
.message-bubble--outbound { background: #e8eefc; align-self: flex-end; border-color: #d3ddf7; }
.message-bubble-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; margin-bottom: 4px; }
.message-bubble-subject { font-size: 12px; margin-bottom: 4px; font-style: italic; }
.message-bubble-body { font-size: 14px; white-space: pre-line; word-break: break-word; }
@media (max-width: 700px) { .message-bubble { max-width: 100%; } }

/* Mobile bottom tab bar - on narrow screens it replaces the sidebar and the modern dock. */
.mobile-tabbar { display: none; }

@media (max-width: 768px) {
    .sidebar,
    .dock,
    html.layout-modern .sidebar,
    html.layout-modern .dock { display: none; }

    .main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
    .content { padding: 16px; }

    .mobile-tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        justify-content: space-around;
        align-items: center;
        gap: 4px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: var(--surface);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 18px rgba(15, 23, 42, .06);
    }

    .mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 56px;
        padding: 6px 4px;
        border: 0;
        border-radius: 14px;
        background: transparent;
        color: var(--text-muted);
        font: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: color .2s ease, background-color .2s ease;
    }

    .mobile-tab svg { transition: transform .2s ease; }

    .mobile-tab-label {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        font-size: 11px;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
        transform: translateY(-3px);
        transition: max-height .2s ease, opacity .2s ease, transform .2s ease, margin-top .2s ease;
    }

    .mobile-tab:hover { text-decoration: none; }
    .mobile-tab.active { color: var(--primary); background: rgba(43, 95, 217, .1); }
    .mobile-tab.active svg { transform: translateY(-1px); }
    .mobile-tab.active .mobile-tab-label { max-height: 16px; margin-top: 3px; opacity: 1; transform: translateY(0); }
}

/* --- Dashboard layout (chart + top sellers row) --- */
.dash-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: stretch; }
.dash-chart { flex: 2; min-width: 340px; }
.dash-top { flex: 1; min-width: 280px; }

/* --- Mobile: compact dashboard --- */
@media (max-width: 768px) {
    .topbar { padding: 12px 16px; }
    .card { padding: 14px; margin-bottom: 14px; border-radius: 12px; }
    h2 { font-size: 15px; margin-bottom: 8px; }

    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
    .stat-card { padding: 12px; border-radius: 12px; }
    .stat-card:hover { transform: none; box-shadow: none; }
    .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .stat-card-icon { width: 26px; height: 26px; font-size: 13px; border-radius: 7px; margin-bottom: 8px; }
    .stat-card .value { font-size: 19px; }
    .stat-card .label { font-size: 11.5px; line-height: 1.3; }
    .stat-card .sublabel { font-size: 10.5px; margin-top: 4px; }

    .dash-row { gap: 0; }
    .dash-chart, .dash-top { flex: 1 1 100%; min-width: 0; }

    .chart-card { gap: 10px; }
    .chart-hero { min-width: 0; width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
    .chart-hero h2 { width: 100%; }
    .chart-hero .hero-value { font-size: 22px; }
    .chart-hero .hero-label { font-size: 12px; margin-top: 0; }
    .chart-hero .hero-sub { width: 100%; font-size: 11px; margin-top: 2px; }
    .chart-plot { min-width: 0; width: 100%; }

    .top-row { gap: 10px; padding: 9px 2px; }
    .top-rank { width: 22px; height: 22px; font-size: 11px; }
    .top-name { font-size: 13px; }
    .top-figures { font-size: 12px; }

    .dash-intro { display: none; }
}

/* --- Orders: mobile list (the desktop table/filters are hidden below 768px) --- */
.m-orders { display: none; }

@media (max-width: 768px) {
    .layout:has(.m-orders) .topbar,
    .orders-desktop { display: none; }
    .m-orders { display: block; }

    .m-orders-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
    .m-orders-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0; }

    .m-icon-btn {
        width: 42px; height: 42px;
        display: flex; align-items: center; justify-content: center;
        border: 0; border-radius: 50%;
        background: transparent; color: var(--primary);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .m-icon-btn[aria-expanded="true"] { background: rgba(43, 95, 217, .1); }

    .m-orders-search { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
    .m-orders-search[hidden] { display: none; }
    .m-orders-search input {
        flex: 1; min-width: 0;
        font-size: 16px; /* 16px+ keeps iOS from zooming in on focus */
        padding: 11px 14px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
    }
    .m-orders-search-clear { font-size: 14px; font-weight: 600; white-space: nowrap; }

    .m-orders-list {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
    }

    .m-order {
        display: flex; align-items: center; gap: 10px;
        padding: 12px 12px 12px 14px;
        border-bottom: 1px solid var(--border);
        color: var(--text);
        -webkit-tap-highlight-color: transparent;
    }
    .m-order:last-child { border-bottom: 0; }
    .m-order:hover { text-decoration: none; }
    .m-order:active { background: #f6f7f9; }

    .m-order-main { flex: 1; min-width: 0; }
    .m-order-date { font-size: 12px; color: var(--text-muted); }
    .m-order-number { font-size: 16px; font-weight: 700; margin: 2px 0 6px; }
    .m-order .badge { font-size: 11.5px; }
    .m-order-total { font-size: 15px; font-weight: 600; white-space: nowrap; }
    .m-order-chevron { flex-shrink: 0; color: #b4b9c3; }

    .m-orders-empty { padding: 20px 14px; color: var(--text-muted); text-align: center; }
}

/* --- Mobile helpers --- */
.m-only { display: none; }
.m-items { display: none; }

/* --- Order detail: mobile --- */
@media (max-width: 768px) {
    .m-hide { display: none !important; }
    .m-only { display: flex; }

    .layout:has(.order-detail-head) .topbar { display: none; }
    .order-detail-head { flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
    .order-detail-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }

    .form-row:has(> .card) { gap: 0; }
    .form-row > .card { flex: 1 1 100% !important; min-width: 0 !important; }

    /* Addresses: shipping first, billing collapsed underneath and slid open on demand. */
    .order-addresses { flex-direction: column; }
    .order-addresses .addr-shipping { order: 1; }
    .order-addresses .addr-billing {
        order: 2;
        display: grid;
        grid-template-rows: 0fr;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
        border-width: 0;
        opacity: 0;
        transition: grid-template-rows .3s ease, padding .3s ease, margin .3s ease, opacity .25s ease;
    }
    .order-addresses .addr-billing-inner { min-height: 0; overflow: hidden; }
    .order-addresses.show-billing .addr-billing {
        grid-template-rows: 1fr;
        padding-top: 14px;
        padding-bottom: 14px;
        margin-bottom: 14px;
        border-width: 1px;
        opacity: 1;
    }
    .addr-shipping p:last-of-type { margin-bottom: 0; }

    .m-toggle-btn {
        width: 100%;
        align-items: center;
        justify-content: center;
        gap: 6px;
        margin-top: 12px;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: #f7f8fa;
        color: var(--primary);
        font: inherit;
        font-weight: 600;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .m-toggle-btn svg { transition: transform .3s ease; }
    .m-toggle-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

    /* Items: the table becomes cards. */
    .order-items-card table { display: none; }
    .order-items-card .section-title { padding: 14px 14px 4px !important; }
    .m-items { display: block; }

    .m-item { padding: 12px 14px; border-bottom: 1px solid var(--border); }
    .m-item:last-child { border-bottom: 0; }
    .m-item-row { display: flex; align-items: center; gap: 12px; }
    .m-item .thumb { width: 52px; height: 52px; flex-shrink: 0; border-radius: 10px; }
    .m-item-info { flex: 1; min-width: 0; }
    .m-item-name {
        font-size: 13.5px; font-weight: 600; line-height: 1.3;
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .m-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
    .m-item-price { flex-shrink: 0; font-weight: 700; white-space: nowrap; }

    .m-item-more {
        display: inline-flex; align-items: center; gap: 4px;
        margin: 8px 0 0 64px; padding: 2px 0;
        border: 0; background: none;
        color: var(--primary); font: inherit; font-size: 12.5px; font-weight: 600;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .m-item-more svg { transition: transform .3s ease; }
    .m-item.is-open .m-item-more svg { transform: rotate(180deg); }

    .m-collapse { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .3s ease, opacity .25s ease; }
    .m-collapse-inner { min-height: 0; overflow: hidden; }
    .m-item.is-open .m-collapse { grid-template-rows: 1fr; opacity: 1; }

    .m-item-details {
        display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
        margin: 10px 0 0; padding: 10px 12px;
        background: #f7f8fa; border-radius: 10px;
        font-size: 12.5px;
    }
    .m-item-details dt { color: var(--text-muted); }
    .m-item-details dd { margin: 0; text-align: right; font-weight: 600; word-break: break-all; }
    .m-item-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
}

/* --- Order detail: mobile section order (info, status, items, totals, shipping address, notes) --- */
@media (max-width: 768px) {
    .content:has(.order-detail-head) { display: flex; flex-direction: column; }
    .od-status-notes { display: contents; }

    .od-info { order: 1; }
    .od-status { order: 2; }
    .order-items-card { order: 3; }
    .od-totals { order: 4; }
    .order-addresses { order: 5; }
    .od-customer-note { order: 6; }
    .od-notes { order: 7; }
}

/* --- Products: mobile list (table, checkboxes and bulk Claude button hidden below 768px) --- */
.m-products { display: none; }

@media (max-width: 768px) {
    .products-table-card,
    .products-bulk { display: none; }

    .m-products {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
        margin-bottom: 14px;
    }

    .m-product {
        display: flex; align-items: center; gap: 12px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--border);
        color: var(--text);
        -webkit-tap-highlight-color: transparent;
    }
    .m-product:last-child { border-bottom: 0; }
    .m-product:hover { text-decoration: none; }
    .m-product:active { background: #f6f7f9; }

    .m-product-thumb {
        width: 64px; height: 64px; flex-shrink: 0;
        object-fit: cover;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: #f0f1f3;
    }

    .m-product-info { flex: 1; min-width: 0; }
    .m-product-name {
        font-size: 14px; font-weight: 600; line-height: 1.3;
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .m-product-sku { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
    .m-product-bottom { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 5px; }
    .m-product-stock { font-size: 12px; font-weight: 600; }
    .m-product-stock.is-in { color: var(--success); }
    .m-product-stock.is-out { color: var(--danger); }
    .m-product-stock.is-backorder { color: var(--warning); }
    .m-product-price { font-size: 14px; font-weight: 700; white-space: nowrap; }

    .m-products-empty { padding: 20px 14px; color: var(--text-muted); text-align: center; }
}

/* --- Products: mobile header + search (same look as the orders list) --- */
@media (max-width: 768px) {
    .layout:has(.m-products) .topbar { display: none; }

    .product-filters #product-search-form { display: none !important; flex: 1 1 100%; align-items: center; gap: 10px; } /* beats the inline display:flex */
    .product-filters.is-searching #product-search-form { display: flex !important; }
    .product-filters #product-search-form input[name="q"] {
        flex: 1; min-width: 0; max-width: none !important;
        font-size: 16px; /* 16px+ keeps iOS from zooming in on focus */
        padding: 11px 14px;
        border-radius: 12px;
    }
    .product-filters .product-search-submit { display: none; }
    .product-filters .product-search-clear {
        border: 0; background: none; padding: 0;
        color: var(--primary); font-size: 14px; font-weight: 600; white-space: nowrap;
    }
}

/* --- Full-screen loading overlay (gcLoading) --- */
.page-loading {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 245, 247, .6);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility 0s linear .2s;
}
.page-loading.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* short delay so instant responses don't flash the overlay */
    transition: opacity .2s ease .15s, visibility 0s linear 0s;
}
.page-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 22px 28px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 40px rgba(15, 23, 42, .14);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    transform: scale(.96);
    transition: transform .2s ease .15s;
}
.page-loading.is-active .page-loading-box { transform: scale(1); }
.page-loading-ring {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid #e3e8f5;
    border-top-color: var(--primary);
    animation: claudeSpin .8s linear infinite;
}

/* --- Mobile header with several icon buttons (mobile only - .m-only must still hide it on desktop) --- */
@media (max-width: 768px) {
    .m-head-actions { display: flex; align-items: center; gap: 2px; }
}

/* --- EAN scanner (products, mobile) --- */
.scanner {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scanner[hidden] { display: none; }
html.scanner-open, html.scanner-open body { overflow: hidden; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.scanner-frame {
    position: relative;
    width: min(82vw, 380px);
    height: min(46vw, 210px);
    border-radius: 16px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5);
    outline: 2px solid rgba(255, 255, 255, .85);
}
.scanner-line {
    position: absolute;
    left: 6%;
    right: 6%;
    top: 50%;
    height: 2px;
    border-radius: 2px;
    background: #ff3b30;
    box-shadow: 0 0 12px 2px rgba(255, 59, 48, .7);
    animation: scannerPulse 1.4s ease-in-out infinite;
}
@keyframes scannerPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.scanner-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(rgba(0, 0, 0, .55), transparent);
}
.scanner-close {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    cursor: pointer;
}
.scanner-message {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: calc(24px + env(safe-area-inset-bottom));
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .75);
    color: #fff;
    font-size: 14px;
    text-align: center;
}

/* --- Product detail: mobile --- */
.m-variants { display: none; }

@media (max-width: 768px) {
    .m-hide-inline { display: none; }

    .content:has(.product-detail-head) { display: flex; flex-direction: column; }
    .layout:has(.product-detail-head) .topbar { display: none; }
    .pd-info { order: 1; }
    .pd-variants { order: 2; }
    .pd-desc { order: 3; }
    .pd-photos { order: 4; }
    .pd-basic { order: 5; }

    /* Header: smaller title + "Späť" on one line, "Vstúpiť do produktu" full width under it. */
    .product-detail-head {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: start;
        gap: 10px 12px;
        margin: 4px 0 14px;
    }
    .product-detail-head h1 { font-size: 18px; font-weight: 700; line-height: 1.3; margin: 0; }
    .product-head-actions { display: contents !important; }
    .product-back { grid-column: 2; grid-row: 1; white-space: nowrap; }
    .product-enter {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 11px 14px;
        border-radius: 12px;
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
        font-size: 14px;
        font-weight: 600;
    }

    /* Info card: photo + SKU/ID side by side, compact. */
    .pd-info { gap: 14px !important; align-items: center; }
    .pd-info .thumb-lg { width: 84px; height: 84px; border-radius: 12px; flex-shrink: 0; }
    .pd-info p { margin: 2px 0; }

    /* Variants: cards instead of the table. */
    .pd-variants h2 { padding: 14px 14px 4px !important; }
    .pd-variants-table { display: none; }
    .m-variants { display: block; }
    .m-variant { padding: 10px 14px; border-top: 1px solid var(--border); scroll-margin-top: 10px; }
    .m-variant-row { display: flex; align-items: center; gap: 12px; }
    .m-variant-thumb {
        width: 48px; height: 48px; flex-shrink: 0;
        object-fit: cover; border-radius: 10px;
        border: 1px solid var(--border); background: #f0f1f3;
    }
    .m-variant-info { flex: 1; min-width: 0; }
    .m-variant-size { font-size: 14px; font-weight: 700; }
    .m-variant-us { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
    .m-variant-sku { font-size: 12px; color: var(--text-muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .m-variant-bottom { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
    .m-variant-bottom .badge { font-size: 11.5px; }
    .m-variant-price { font-size: 13px; font-weight: 700; white-space: nowrap; }
    .m-variant-details { flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; }
    .m-variant-details svg { transition: transform .3s ease; }
    .m-variant.is-open .m-variant-details { background: rgba(43, 95, 217, .1); border-color: rgba(43, 95, 217, .35); color: var(--primary); }
    .m-variant.is-open .m-variant-details svg { transform: rotate(180deg); }
    .m-variant.is-open .m-collapse { grid-template-rows: 1fr; opacity: 1; }

    .m-variant-editor { margin-top: 12px; padding: 12px; border-radius: 12px; background: #f7f8fa; }
    .m-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .m-field { display: flex; flex-direction: column; gap: 4px; margin: 0; font-weight: 400; }
    .m-field span, .m-wh span { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
    .m-field input, .m-wh input {
        width: 100%;
        font-size: 16px; /* no iOS zoom on focus */
        padding: 9px 10px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface);
    }
    .m-field input:disabled, .m-wh input:disabled { background: #eef0f4; color: var(--text-muted); }
    .m-wh-title { margin: 14px 0 8px; font-size: 13px; font-weight: 700; }
    .m-wh-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .m-wh { display: flex; flex-direction: column; gap: 4px; margin: 0; font-weight: 400; }
    .m-wh-total { margin-top: 10px; font-size: 13px; }
    .m-variant-save { width: 100%; margin-top: 12px; padding: 11px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; }

    /* Photos: view only, 3-up grid. */
    .pd-photos .gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .pd-photos .gallery-item { width: auto; padding: 4px; }
    .pd-photos .gallery-item img { height: auto; aspect-ratio: 1; }
    .pd-photos .gallery-item .gallery-tag { top: 6px; left: 6px; font-size: 10px; padding: 1px 6px; }
    .pd-photos #gallery-sortable .gallery-item { cursor: default; }
}

/* --- Mobile "Menu" page (/menu) --- */
.layout:has(.m-menu) .topbar { display: none; }
.m-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 520px;
    min-height: calc(100vh - 140px - env(safe-area-inset-bottom));
    min-height: calc(100dvh - 140px - env(safe-area-inset-bottom));
}

.m-menu-head { display: flex; align-items: center; gap: 14px; padding: 8px 2px 4px; }
.m-menu-avatar {
    width: 52px; height: 52px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #001340);
    color: #fff; font-size: 22px; font-weight: 800;
}
.m-menu-head-text { min-width: 0; }
.m-menu-shop { font-size: 21px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.m-menu-user { margin-top: 3px; font-size: 14px; font-weight: 600; }
.m-menu-user span { color: var(--text-muted); font-weight: 500; }

.m-menu-tiles { display: flex; flex-direction: column; gap: 10px; }
.m-menu-tile {
    display: flex; align-items: center; gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    transition: transform .12s ease, background-color .12s ease;
}
.m-menu-tile:hover { text-decoration: none; }
.m-menu-tile:active { transform: scale(.98); background: #f6f7f9; }
.m-menu-tile-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
}
.m-menu-tile-icon.is-blue { background: #e8eefc; color: var(--primary); }
.m-menu-tile-icon.is-green { background: #e6f6ec; color: var(--success); }
.m-menu-tile-label { flex: 1; font-size: 15px; font-weight: 600; }
.m-menu-tile-chevron { color: #b4b9c3; flex-shrink: 0; }

.m-menu-logout { margin-top: auto; }
.m-menu-logout button {
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 14px;
    border: 1px solid #f2c6c6;
    border-radius: 14px;
    background: #fdf2f2;
    color: var(--danger);
    font: inherit; font-size: 15px; font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.m-menu-logout button:active { background: #fbe4e4; }

/* --- Stock take (inventúra) --- */
.m-only-inline { display: none; }
.counted-input.is-saved { animation: stSaved 1.2s ease; }
.counted-input.is-error { outline: 2px solid var(--danger); }
@keyframes stSaved { 0% { box-shadow: 0 0 0 3px rgba(31, 157, 85, .45); border-color: var(--success); } 100% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0); } }

@media (max-width: 768px) {
    .m-only-inline { display: inline; }
    dialog.stock-modal { max-width: calc(100vw - 24px); }
    .stock-modal-inner { padding: 16px; }

    /* index */
    .layout:has(.st-page-title) .topbar,
    .layout:has(.st-head) .topbar { display: none; }
    .st-page-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 12px; }
    .st-warehouses .stat-card-icon { display: none; }
    .st-warehouses .value { font-size: 15px; }

    table.st-list thead, table.st-items thead { display: none; }
    table.st-list tr, table.st-items tr { display: grid; border-bottom: 1px solid var(--border); padding: 12px 14px; gap: 4px 10px; }
    table.st-list tr:last-child, table.st-items tr:last-child { border-bottom: 0; }
    table.st-list td, table.st-items td { display: block; padding: 0; border: 0; background: none !important; }
    table.st-list tr:hover td, table.st-items tr:hover td { background: none; }

    table.st-list tr {
        grid-template-columns: 1fr auto;
        grid-template-areas: "wh status" "date filled" "actions actions";
        align-items: center;
    }
    .st-list .st-wh { grid-area: wh; font-size: 15px; font-weight: 700; }
    .st-list .st-status { grid-area: status; text-align: right; }
    .st-list .st-date { grid-area: date; font-size: 12px; color: var(--text-muted); }
    .st-list .st-filled { grid-area: filled; font-size: 12px; color: var(--text-muted); text-align: right; }
    .st-list .st-actions { grid-area: actions; display: flex; gap: 8px; margin-top: 8px; }
    .st-list .st-actions .btn { flex: 1; text-align: center; padding: 9px 10px; border-radius: 10px; }
    .st-list td[colspan] { grid-column: 1 / -1; }

    /* detail */
    .st-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px 8px; margin: 4px 0 6px; }
    .st-head h1 { font-size: 20px; font-weight: 800; line-height: 1.25; }
    .st-head .st-save { grid-column: 1 / -1; text-align: center; padding: 11px 14px; border-radius: 12px; font-weight: 600; }
    .st-filters input[name="q"] { display: none; }
    .st-filters.is-searching input[name="q"] { display: block; }
    .st-meta { font-size: 12.5px; margin: 0 0 12px; }

    .st-filters { flex-direction: column; align-items: stretch; gap: 8px; }
    .st-filters input[name="q"] { max-width: none !important; font-size: 16px; padding: 11px 14px; border-radius: 12px; }
    .st-filters select { font-size: 15px; padding: 9px 10px; border-radius: 10px; }
    .st-filters > button[type="submit"] { display: none; }

    table.st-items tr {
        grid-template-columns: 1fr auto;
        grid-template-areas: "name name" "sku sku" "ean ean" "stock count";
        align-items: center;
    }
    .st-items .st-name { grid-area: name; font-size: 14px; font-weight: 600; line-height: 1.3; }
    .st-items .st-name a { color: var(--text); }
    .st-items .st-sku { grid-area: sku; font-size: 12px; color: var(--text-muted); }
    .st-items .st-ean { grid-area: ean; font-size: 12px; color: var(--text-muted); }
    .st-items .st-stock { grid-area: stock; font-size: 13px; margin-top: 6px; }
    .st-items .st-count { grid-area: count; display: flex; align-items: center; gap: 6px; margin-top: 6px; }
    .st-items td[colspan] { grid-column: 1 / -1; }

    .st-count .counted-input {
        width: 64px; max-width: none !important;
        text-align: center;
        font-size: 17px; font-weight: 700;
        padding: 8px 4px;
        border-radius: 10px;
        -moz-appearance: textfield;
    }
    .st-count .counted-input::-webkit-outer-spin-button,
    .st-count .counted-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
    .st-step {
        width: 40px; height: 40px;
        display: flex; align-items: center; justify-content: center;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface);
        color: var(--primary);
        font-size: 22px; font-weight: 600; line-height: 1;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .st-step:active { background: rgba(43, 95, 217, .1); }
    .st-step:disabled { color: #b4b9c3; }
}

/* --- Mobile menu: violet tile icon --- */
.m-menu-tile-icon.is-violet { background: #efe9fc; color: #5b4fd1; }

/* --- Coupons: mobile --- */
@media (max-width: 768px) {
    /* Date fields: same look as the other inputs (iOS otherwise draws its own centered, grey pill). */
    input[type=date] {
        -webkit-appearance: none;
        appearance: none;
        display: block;
        width: 100%;
        min-height: 38px;
        padding: 8px 10px;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: #fff;
        color: var(--text);
        font: inherit;
        font-size: 14px;
        text-align: left;
    }
    input[type=date]::-webkit-date-and-time-value { text-align: left; margin: 0; }
    input[type=date]::-webkit-calendar-picker-indicator { opacity: .55; }

    .layout:has(.cp-head) .topbar,
    .layout:has(.cp-form-head) .topbar { display: none; }

    .cp-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px 8px; margin: 4px 0 12px; }
    .cp-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
    .cp-head .cp-new { grid-column: 1 / -1; text-align: center; padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; }

    .cp-filters { gap: 8px; }
    .cp-filters input[name="q"] { display: none; flex: 1 1 100%; max-width: none !important; padding: 11px 14px; border-radius: 12px; }
    .cp-filters.is-searching input[name="q"] { display: block; }
    .cp-filters select { flex: 1 1 100%; padding: 9px 10px; border-radius: 10px; }
    .cp-filters > button[type="submit"] { display: none; }

    .coupon-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .coupon-card:hover { transform: none; box-shadow: 0 1px 3px rgba(20, 24, 33, .06); }
    .coupon-amount { width: 92px; }
    .coupon-amount-value { font-size: 22px; }
    .coupon-body { padding: 12px 14px; gap: 6px; }
    .coupon-actions .btn, .coupon-actions form { flex: 1; }
    .coupon-actions form .btn { width: 100%; }

    .cp-form-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin: 4px 0 12px; }
    .cp-form-head h1 { font-size: 24px; font-weight: 800; margin: 0; }
    .coupon-preview-wrap { margin-bottom: 14px; }
    .coupon-preview-wrap .coupon-card { max-width: none; }

    .cp-form { padding: 14px; }
    .cp-form .form-group { margin-bottom: 12px; }
    .cp-form .form-group label { font-size: 12px; margin-bottom: 4px; }
    .cp-form input[type=text], .cp-form input[type=number], .cp-form input[type=date], .cp-form select { font-size: 14px; min-height: 38px; }
    .cp-form .text-muted { font-size: 12px; }
    .cp-form .form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
    .cp-form .form-row .form-group { min-width: 0; }
    .cp-form .form-row:first-child .form-group:first-child { grid-column: 1 / -1; }
    .cp-form .form-row:first-child .checkbox-row { margin-top: -4px; }
    .cp-form .cat-editor summary { width: 100%; text-align: center; }
    .cp-save { width: 100%; padding: 12px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; }
}

/* ===== NonStop Potraviny / OBERON additions ===== */
.log-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 8px 16px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; word-break: break-word; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--text-muted); vertical-align: middle; }
.status-dot.ok { background: var(--success); }
.status-dot.err { background: var(--danger); }
.status-dot.run { background: var(--warning); animation: gcPulse 1.2s ease-in-out infinite; }
@keyframes gcPulse { 50% { opacity: .3; } }
.test-steps { list-style: none; padding: 0; margin: 0; }
.test-steps li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.test-steps li:last-child { border-bottom: none; }
.raw-json { margin: 8px 0 0; padding: 12px; background: #0f1117; color: #e6e6e6; border-radius: 8px; font-size: 11.5px; line-height: 1.5; overflow: auto; max-height: 420px; }
.amount-neg { color: var(--danger); font-weight: 700; }
.amount-zero { color: var(--text-muted); }
@media (max-width: 768px) {
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dd { margin-bottom: 8px; }
    .products-table .hide-m { display: none; }
}
.filters select { width: auto; max-width: 260px; }
.sort-th { color: inherit; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sort-th:hover { color: var(--text); text-decoration: none; }
.sort-th.is-active { color: var(--primary); }
.sort-arrow { font-size: 9px; opacity: .45; }
.sort-th.is-active .sort-arrow { opacity: 1; }

/* --- Tržby (kniha tržieb) --- */
.sales-monthnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.sales-monthnav input[type=month] { width: auto; padding: 5px 8px; }
.sales-monthname { font-size: 15px; margin-left: 4px; }
.sales-row { cursor: pointer; }
.sales-row:hover td { background: #f6f8fc; }
.sales-row.is-weekend td:first-child { box-shadow: inset 3px 0 0 #e8eefc; }
.sales-table tfoot th, .sales-bills tfoot th { border-top: 2px solid var(--border); }
.sales-bar { height: 4px; border-radius: 100px; background: #eef0f4; margin-top: 5px; min-width: 80px; overflow: hidden; }
.sales-bar > div { height: 100%; border-radius: 100px; background: var(--success); }
.sales-hours { display: flex; gap: 4px; align-items: flex-end; min-width: 560px; }
.sales-hour { flex: 1; text-align: center; }
.sales-hour-bar { height: 110px; display: flex; align-items: flex-end; background: #f6f7f9; border-radius: 4px; overflow: hidden; }
.sales-hour-bar > div { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; }
.sales-hour-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.sales-caret { display: inline-block; width: 12px; color: var(--text-muted); }
.sales-bill-detail > td { background: #fafbfc; padding: 10px 14px 14px; }
.sales-bill-meta { font-size: 12px; margin-bottom: 8px; word-break: break-word; }
.sales-items { width: 100%; font-size: 13px; }
.sales-items tfoot td { border-top: 1px solid var(--border); }
@media (max-width: 768px) {
    .sales-table .hide-m, .sales-bills .hide-m, .sales-items .hide-m { display: none; }
}

/* --- Reporty --- */
.report-tile-soon { border-style: dashed; opacity: .85; }

/* --- Výdaje --- */
.expense-quick { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.filters label { display: inline-flex; align-items: center; gap: 6px; }
dialog.expense-modal { width: 520px; }
dialog.expense-picker { width: 440px; }
.expense-name-field {
    width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
    font: inherit; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; text-align: left;
}
.expense-name-field:hover { border-color: var(--primary); }
.expense-name-field.is-empty { font-weight: 400; color: var(--text-muted); }
.expense-name-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; margin-top: 10px; }
.expense-name-option, .expense-name-new {
    display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
    font: inherit; font-size: 14px; color: var(--text); cursor: pointer; text-align: left;
}
.expense-name-option:hover { background: #f1f4fb; border-color: #d3ddf7; }
.expense-name-option.is-selected { border-color: var(--primary); background: #e8eefc; }
.expense-name-new { margin-top: 10px; border-style: dashed; border-color: var(--primary); color: var(--primary); font-weight: 600; justify-content: flex-start; }
.expense-name-new:hover { background: #e8eefc; }
@media (max-width: 768px) {
    .expense-table .hide-m { display: none; }
}
