/* Multi-Store Product Monitor — admin theme on top of Bootstrap 5.3 */
:root {
    --pm-bg: #f4f5f7;
    --pm-surface: #ffffff;
    --pm-border: #e3e6ea;
    --pm-text: #1d2330;
    --pm-muted: #6b7382;
    --pm-accent: #2f5bd3;
    --pm-accent-soft: #eaf0fd;
    --pm-sidebar-w: 248px;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-font-size: .875rem;
    --bs-body-color: var(--pm-text);
    --bs-border-color: var(--pm-border);
    --bs-primary: #2f5bd3;
    --bs-primary-rgb: 47, 91, 211;
    --bs-link-color: #2f5bd3;
    --bs-link-color-rgb: 47, 91, 211;
}

body.app { background: var(--pm-bg); }
.tabular, .table td, .stat-value { font-variant-numeric: tabular-nums; }
a { text-decoration: none; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--pm-sidebar-w);
    background: var(--pm-surface);
    border-right: 1px solid var(--pm-border);
    display: flex;
    flex-direction: column;
}
@media (min-width: 992px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; overflow-y: auto; }
    .main { margin-left: var(--pm-sidebar-w); }
}
.sidebar-brand {
    height: 60px; padding: 0 1.1rem; display: flex; align-items: center;
    border-bottom: 1px solid var(--pm-border);
}
.brand-mark {
    width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center;
    background: var(--pm-accent); color: #fff; font-size: 1.05rem;
}
.brand-name { font-weight: 700; color: var(--pm-text); letter-spacing: -.01em; }
.sidebar-nav { padding: .75rem .6rem 1.5rem; display: flex; flex-direction: column; gap: 1px; }
.sidebar-nav .nav-section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--pm-muted);
    font-weight: 600; padding: 1rem .7rem .35rem;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .65rem; padding: .45rem .7rem; border-radius: 6px;
    color: #3a4252; font-weight: 500;
}
.sidebar-nav .nav-link i { font-size: 1rem; color: #7b8494; width: 1.1rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: #f1f3f6; color: var(--pm-text); }
.sidebar-nav .nav-link.active { background: var(--pm-accent-soft); color: var(--pm-accent); }
.sidebar-nav .nav-link.active i { color: var(--pm-accent); }
.sidebar-nav .nav-sub { padding-left: 1.2rem; font-weight: 400; }

/* ---------- Topbar ---------- */
.topbar {
    height: 60px; background: var(--pm-surface); border-bottom: 1px solid var(--pm-border);
    display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; position: sticky; top: 0; z-index: 1020;
}
.topbar-search { position: relative; flex: 0 1 460px; }
.topbar-search i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--pm-muted); }
.topbar-search .form-control { padding-left: 2.1rem; background: #f4f5f7; border-color: transparent; height: 36px; }
.topbar-search .form-control:focus { background: #fff; border-color: #bcc9ee; box-shadow: 0 0 0 3px rgba(47,91,211,.12); }
.btn-icon { border: 0; background: transparent; color: #4a5263; padding: .3rem .45rem; }
.btn-icon:hover { color: var(--pm-text); background: #f1f3f6; }
.bell-count { position: absolute; top: -2px; right: -6px; font-size: .62rem; }
.avatar {
    width: 26px; height: 26px; border-radius: 50%; background: #dfe6f7; color: var(--pm-accent);
    display: inline-grid; place-items: center; font-weight: 700; font-size: .75rem;
}
.notif-dropdown { width: 400px; max-width: calc(100vw - 1.5rem); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: flex; gap: .65rem; padding: .65rem .9rem; border-bottom: 1px solid #f0f1f4; }
.notif-item.unread { background: #f7f9ff; }
.notif-item .notif-icon { flex: 0 0 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; }
.notif-item .notif-actions { opacity: 0; transition: opacity .15s; }
.notif-item:hover .notif-actions { opacity: 1; }

/* ---------- Layout ---------- */
.content { padding: 1.4rem 1.5rem 2rem; }
.footer { padding: 0 1.5rem 1.25rem; color: var(--pm-muted); font-size: .75rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.page-header h1 { font-size: 1.3rem; font-weight: 700; margin: 0; letter-spacing: -.015em; }
.page-header .subtitle { color: var(--pm-muted); font-size: .82rem; }
.breadcrumb { font-size: .78rem; margin-bottom: .2rem; }

.card { border-color: var(--pm-border); border-radius: 10px; box-shadow: 0 1px 2px rgba(16,24,40,.03); }
.card-header { background: transparent; border-bottom-color: var(--pm-border); padding: .75rem 1rem; font-weight: 600; }
.card-header .card-title { font-size: .92rem; margin: 0; font-weight: 600; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat {
    background: var(--pm-surface); border: 1px solid var(--pm-border); border-radius: 10px; padding: .8rem .9rem;
    display: block; color: inherit; transition: border-color .15s;
}
a.stat:hover { border-color: #b9c6ea; }
.stat-label { font-size: .72rem; color: var(--pm-muted); font-weight: 500; display: flex; align-items: center; gap: .35rem; }
.stat-label i { font-size: .85rem; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; margin-top: .25rem; letter-spacing: -.02em; }
.stat-sub { font-size: .7rem; color: var(--pm-muted); }
.stat-value.small-value { font-size: .95rem; font-weight: 600; margin-top: .45rem; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .55rem .75rem; border-bottom-color: #eef0f3; }
.table thead th {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pm-muted);
    font-weight: 600; background: #fafbfc; white-space: nowrap; border-bottom-color: var(--pm-border);
}
.table thead th a { color: inherit; }
.table thead th a:hover { color: var(--pm-text); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8f9fb; }
.table td { vertical-align: middle; }
.table .cell-title { max-width: 360px; }
.table .cell-title a { color: var(--pm-text); font-weight: 500; }
.table .cell-title a:hover { color: var(--pm-accent); }
.thumb {
    width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #f0f2f5;
    border: 1px solid var(--pm-border); display: inline-grid; place-items: center; color: #aab1bd;
}
.thumb-lg { width: 120px; height: 120px; border-radius: 10px; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.muted { color: var(--pm-muted); }
.fs-xs { font-size: .72rem; }
.nowrap { white-space: nowrap; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; letter-spacing: .01em; }
.badge-change { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; padding: .32em .55em; }
.text-bg-light.badge-change { border: 1px solid var(--pm-border); color: #4a5263 !important; }
.badge.bg-danger-subtle { color: #a61b29; }
.badge.bg-success-subtle { color: #146c43; }
.badge-soft { background: #f1f3f6; color: #4a5263; border: 1px solid var(--pm-border); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Prices */
.price-now { font-weight: 600; }
.price-was { color: var(--pm-muted); text-decoration: line-through; font-size: .8em; margin-right: .3rem; }
.off-badge { background: #fff4e0; color: #9a5b00; border: 1px solid #ffe2ad; font-size: .68rem; }
.change-values { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.change-values .old { color: var(--pm-muted); }
.change-values .old.strike { text-decoration: line-through; }
.change-values .arrow { color: #aab1bd; }
.change-values .new { font-weight: 600; }

/* Filters */
.filter-bar { background: var(--pm-surface); border: 1px solid var(--pm-border); border-radius: 10px; padding: .75rem; margin-bottom: 1rem; }
.filter-bar .form-control, .filter-bar .form-select { font-size: .82rem; }
.group-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .9rem; }
.group-tabs a {
    border: 1px solid var(--pm-border); background: var(--pm-surface); color: #3a4252; border-radius: 999px;
    padding: .3rem .8rem; font-size: .8rem; font-weight: 500;
}
.group-tabs a.active { background: var(--pm-text); border-color: var(--pm-text); color: #fff; }
.group-tabs a .count { color: var(--pm-muted); margin-left: .25rem; font-weight: 400; }
.group-tabs a.active .count { color: #c9ceda; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 2px; background: #eceef2; }
.timeline li { position: relative; padding: 0 0 1rem 44px; }
.timeline .tl-icon {
    position: absolute; left: 3px; top: 0; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-size: .75rem; border: 2px solid #fff;
}
.timeline .tl-time { font-size: .72rem; color: var(--pm-muted); }

/* Health */
.health-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; border-bottom: 1px solid #f0f1f4; }
.health-row:last-child { border-bottom: 0; }

.dl-grid { display: grid; grid-template-columns: 160px 1fr; gap: .45rem 1rem; margin: 0; }
.dl-grid dt { color: var(--pm-muted); font-weight: 500; font-size: .8rem; }
.dl-grid dd { margin: 0; word-break: break-word; }
pre.raw { max-height: 480px; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 8px; font-size: .75rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--pm-muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #c3c8d2; }

.pagination { margin: 0; --bs-pagination-font-size: .8rem; }

/* Login */
body.guest { background: #eef1f6; min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: 100%; max-width: 390px; }
.login-card .card { border-radius: 14px; box-shadow: 0 10px 30px rgba(16,24,40,.08); }

.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 575.98px) {
    .content { padding: 1rem .75rem 1.5rem; }
    .topbar { padding: 0 .75rem; }
    .dl-grid { grid-template-columns: 1fr; }
}

/* Keep before/after values readable inside dense tables */
.cell-values { min-width: 210px; }
.table .cell-title { min-width: 180px; }
@media (min-width: 1200px) and (max-width: 1500px) {
    .filter-bar .col-xl-1 { flex: 0 0 auto; width: 12.5%; }
}
.filter-bar .form-select { min-width: 0; }
.cell-before, .cell-after { min-width: 150px; max-width: 280px; }
