/* Planogram Platform: custom styles on top of Bootstrap 5 */

:root {
    --pg-ink: #1c2530;
    --pg-muted: #5f6b7a;
    --pg-line: #e2e6ec;
    --pg-bg: #f4f6f9;
    --pg-accent: #1f6feb;
    --pg-accent-dark: #1859c0;
}

body {
    color: var(--pg-ink);
    background: var(--pg-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- Brand ---- */
.brand-mark {
    display: inline-block;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background:
        linear-gradient(var(--pg-accent), var(--pg-accent)) 4px 5px / 18px 4px no-repeat,
        linear-gradient(var(--pg-accent), var(--pg-accent)) 4px 11px / 18px 4px no-repeat,
        linear-gradient(var(--pg-accent), var(--pg-accent)) 4px 17px / 18px 4px no-repeat,
        #dbe8fd;
    vertical-align: middle;
}
.brand-name {
    font-weight: 650;
    letter-spacing: -0.01em;
    vertical-align: middle;
    margin-left: 8px;
}

/* ---- Buttons and inputs ---- */
.btn-primary {
    --bs-btn-bg: var(--pg-accent);
    --bs-btn-border-color: var(--pg-accent);
    --bs-btn-hover-bg: var(--pg-accent-dark);
    --bs-btn-hover-border-color: var(--pg-accent-dark);
    --bs-btn-active-bg: var(--pg-accent-dark);
    --bs-btn-active-border-color: var(--pg-accent-dark);
    font-weight: 600;
}
.form-control { border-color: #cfd6df; }
.form-control:focus {
    border-color: var(--pg-accent);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.18);
}
.form-label { font-weight: 600; font-size: 0.92rem; }
a { color: var(--pg-accent); }

/* ---- Sign-in style pages ---- */
.auth-body { min-height: 100vh; }
.auth-wrap {
    max-width: 430px;
    margin: 0 auto;
    padding: 9vh 16px 40px;
}
.auth-brand { text-align: center; margin-bottom: 22px; font-size: 1.15rem; }
.auth-card {
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 14px;
    padding: 30px 28px;
    box-shadow: 0 8px 28px rgba(28, 37, 48, 0.07);
}
.auth-title { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
.auth-subtitle { color: var(--pg-muted); margin-bottom: 20px; }
.auth-card .alert { font-size: 0.93rem; padding: 10px 14px; }
.auth-links { margin-top: 16px; text-align: center; font-size: 0.93rem; }
.auth-foot { text-align: center; color: var(--pg-muted); font-size: 0.8rem; margin-top: 18px; }
.password-rules { color: var(--pg-muted); font-size: 0.88rem; padding-left: 18px; margin-bottom: 18px; }

/* Honeypot field: hidden from people, visible to bots */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---- Logged-in area ---- */
.app-nav {
    background: #fff;
    border-bottom: 1px solid var(--pg-line);
    padding-top: 10px;
    padding-bottom: 10px;
}
.app-nav .nav-link { color: var(--pg-muted); font-weight: 500; }
.app-nav .nav-link.active, .app-nav .nav-link:hover { color: var(--pg-ink); }
.nav-user { color: var(--pg-ink); font-weight: 600; font-size: 0.92rem; padding: 0 10px; }
.role-badge { background: #e8f0fe; color: var(--pg-accent-dark); font-weight: 600; margin-left: 6px; }
.app-main { padding-top: 28px; padding-bottom: 48px; }
.panel {
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 12px;
    padding: 24px;
}
.panel h1 { font-size: 1.35rem; font-weight: 700; }
.panel-narrow { max-width: 520px; }
.muted { color: var(--pg-muted); }

/* ---- Installer ---- */
.install-wrap { max-width: 760px; margin: 0 auto; padding: 5vh 16px 60px; }
.install-section { border-top: 1px solid var(--pg-line); margin-top: 24px; padding-top: 22px; }
.install-section h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid #f0f2f5; font-size: 0.94rem; }
.check-ok { color: #1a7f37; font-weight: 600; white-space: nowrap; }
.check-bad { color: #c62828; font-weight: 600; white-space: nowrap; }
.check-warn { color: #9a6700; font-weight: 600; white-space: nowrap; }

/* ---- Admin lists and forms ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--pg-muted); }
.panel-title { font-size: 1.02rem; font-weight: 700; margin-bottom: 16px; }
.panel.p-0 { overflow: hidden; }
.table-responsive { position: relative; }   /* keeps hidden table labels from widening the page */
.data-table { font-size: 0.93rem; }
.data-table thead th { background: #f7f9fb; color: var(--pg-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--pg-line); padding: 10px 14px; white-space: nowrap; }
.data-table td { padding: 10px 14px; border-color: #eef1f5; }
.badge-on { background: #e3f4e8; color: #1a7f37; font-weight: 600; }
.badge-off { background: #eef0f3; color: #5f6b7a; font-weight: 600; }
.badge-warn { background: #fff1d6; color: #8a5a00; font-weight: 600; }
.badge-bad { background: #fde3e3; color: #b42318; font-weight: 600; }
.nav-count { background: var(--pg-accent); color: #fff; margin-left: 4px; font-weight: 600; }
.app-nav .nav-link { white-space: nowrap; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--pg-line); }
.tabs a { padding: 9px 14px; color: var(--pg-muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--pg-ink); border-bottom-color: var(--pg-accent); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--pg-line); border-radius: 12px; padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.stat-num { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--pg-muted); font-size: 0.88rem; }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid #eef1f5; }
.notice-list li:last-child { border-bottom: 0; }
.notice-time { color: var(--pg-muted); font-size: 0.82rem; white-space: nowrap; }
.sub-row td:first-child { padding-left: 34px; }
.detail-list { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; font-size: 0.94rem; }
.detail-list dt { color: var(--pg-muted); font-weight: 500; }
.detail-list dd { margin: 0; }

/* ---- Drag-and-drop ordering ---- */
.drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #9aa4b2; cursor: grab; flex: 0 0 auto; touch-action: none; }
.drag-handle svg { fill: currentColor; }
.drag-handle:hover, .drag-handle:focus-visible { color: var(--pg-ink); background: #eef1f5; outline: none; }
.drag-handle:focus-visible { box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.25); }
.drag-hint svg { fill: #9aa4b2; vertical-align: -3px; }
.sort-chosen { cursor: grabbing; }
.sort-ghost { opacity: 0.35; }
.sortable-fallback { opacity: 0.9 !important; box-shadow: 0 8px 24px rgba(28, 37, 48, 0.18); background: #fff; }
.th-handle, .td-handle { width: 40px; padding-right: 0 !important; }
.order-num { display: inline-block; min-width: 26px; padding: 1px 7px; border-radius: 6px; background: #eef1f5; color: var(--pg-muted); font-size: 0.8rem; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.sort-status { min-height: 1.4em; padding-top: 8px; padding-bottom: 8px; font-size: 0.86rem; color: #1a7f37; }
.sort-status.is-error { color: #b42318; }

/* ---- Category tree ---- */
.cat-tree { list-style: none; margin: 0; padding: 0; }
.cat-kids > .cat-tree { margin-left: 22px; padding-left: 12px; border-left: 2px solid #e6eaf0; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; flex-wrap: wrap; }
.cat-row:hover { background: #f7f9fb; }
.cat-row.is-current { background: #eef4ff; }
.cat-row.is-hidden .cat-name { color: var(--pg-muted); text-decoration: line-through; }
.cat-name { font-weight: 600; }
.cat-meta { color: var(--pg-muted); font-size: 0.84rem; }
.cat-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px; }
.cat-toggle, .cat-toggle-spacer { width: 24px; height: 24px; flex: 0 0 auto; }
.cat-toggle { border: 0; border-radius: 6px; background: transparent; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.cat-toggle:hover { background: #eef1f5; }
.cat-toggle .caret { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 6px solid var(--pg-muted); transition: transform 0.15s; }
.cat-toggle[aria-expanded="true"] .caret { transform: rotate(90deg); }
.form-panel.sticky-lg-top { top: 16px; }
@media (max-width: 575.98px) {
    .cat-actions { margin-left: 62px; width: 100%; }
    .cat-kids > .cat-tree { margin-left: 8px; padding-left: 8px; }
}

/* ---- Planograms ---- */
.filter-bar { padding: 16px 18px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 14px; }
.check-grid .form-check { margin: 0; }
.chip { display: inline-block; background: #e8f0fe; color: var(--pg-accent-dark); border-radius: 999px; padding: 2px 10px; font-size: 0.8rem; font-weight: 600; margin: 0 6px 6px 0; }
.picker { border: 1px solid #cfd6df; border-radius: 8px; padding: 10px; }
.picker-list { max-height: 260px; overflow-y: auto; margin: 8px 0; padding-right: 4px; }
.picker-tree { list-style: none; margin: 0; padding: 0; }
.picker-tree .picker-tree { padding-left: 22px; }
.picker-item { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; cursor: pointer; font-size: 0.93rem; }
.picker-item:hover { background: #f4f6f9; }
.picker-item .form-check-input { margin: 0; }
.picker-summary { border-top: 1px solid #eef1f5; padding-top: 8px; min-height: 30px; }
.viewer { border: 1px solid var(--pg-line); border-radius: 10px; overflow: hidden; background: #e9edf2; }
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--pg-line); }
.viewer-pages { color: var(--pg-muted); font-size: 0.88rem; margin-right: auto; }
.viewer-body { height: 70vh; min-height: 360px; overflow: auto; padding: 12px; outline: none; }
.viewer-page { margin: 0 auto 12px; background: #fff; box-shadow: 0 1px 4px rgba(28, 37, 48, 0.18); }
.viewer-page canvas { display: block; width: 100%; height: 100%; }
.viewer-error { color: var(--pg-muted); text-align: center; margin-top: 40px; }
.viewer-image { display: flex; align-items: flex-start; justify-content: center; cursor: zoom-in; }
.viewer-image img { max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(28, 37, 48, 0.18); }
.viewer-image.is-zoomed { display: block; cursor: zoom-out; }
.viewer-image.is-zoomed img { max-width: none; }
.items-table td { padding-top: 6px; padding-bottom: 6px; }
.items-table td:nth-child(1) { min-width: 140px; }
.items-table td:nth-child(2) { min-width: 140px; }
.items-table td:nth-child(3) { min-width: 260px; }
.items-table .new-row td { background: #f7f9fb; }

/* ---- Store side ---- */
.nav-go { display: flex; gap: 6px; margin: 0 10px 0 auto; flex: 0 1 260px; min-width: 0; }
.nav-go .form-control { width: 100%; min-width: 0; text-transform: uppercase; }
@media (min-width: 1200px) { .nav-go { order: 3; margin: 0 0 0 12px; flex-basis: 200px; } .app-nav .navbar-collapse { order: 2; } }
.nav-go .form-control::placeholder { text-transform: none; }
.badge-new { background: #e3f4e8; color: #1a7f37; font-weight: 700; }
.badge-updated { background: #e8f0fe; color: var(--pg-accent-dark); font-weight: 700; }
.search-hero { background: #fff; border: 1px solid var(--pg-line); border-radius: 14px; padding: 18px; margin-bottom: 20px; }
.search-row { display: flex; gap: 8px; }
.search-row .form-control { flex: 1 1 auto; min-width: 0; }
.search-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 12px; font-size: 0.93rem; }
.results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.result-card { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--pg-line); border-radius: 12px; padding: 16px; color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.result-card:hover, .result-card:focus-visible { border-color: var(--pg-accent); box-shadow: 0 4px 16px rgba(31, 111, 235, 0.12); }
.result-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.file-badge { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; color: var(--pg-muted); border: 1px solid var(--pg-line); border-radius: 4px; padding: 1px 6px; }
.result-title { font-size: 1.05rem; font-weight: 700; margin: 2px 0 0; line-height: 1.3; }
.result-cats { color: var(--pg-muted); font-size: 0.86rem; }
.result-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.86rem; }
.result-hit { font-size: 0.82rem; color: #1a7f37; font-weight: 600; }
.empty-state { text-align: center; padding: 36px 20px; }
.code-chip { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; font-size: 0.85rem; background: #1c2530; color: #fff; border-radius: 6px; padding: 2px 8px; letter-spacing: 0.02em; }
.code-chip-empty { background: #eef1f5; color: var(--pg-muted); font-family: inherit; font-weight: 600; }
.code-link { text-decoration: none; }
.location-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 18px; }
.location-pill { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--pg-line); border-radius: 999px; padding: 4px 12px 4px 4px; font-size: 0.9rem; }
.location-pill.is-current { border-color: var(--pg-accent); box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15); }
.location-list { list-style: none; margin: 0; padding: 0; }
.location-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef1f5; }
.saved-pill { opacity: 1 !important; }
.save-cta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.pre-line { white-space: pre-line; }
.vendor-products summary { cursor: pointer; }
.code-input { text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-input::placeholder { text-transform: none; font-family: inherit; }
.go-panel .form-control-lg { text-transform: uppercase; }
.go-panel .form-control-lg::placeholder { text-transform: none; }
.aisle-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mine-list { list-style: none; margin: 10px 0 0; padding: 0; }
.mine-list li a { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 8px; border-radius: 8px; color: inherit; text-decoration: none; border-top: 1px solid #eef1f5; }
.mine-list li:first-child a { border-top: 0; }
.mine-list li a:hover { background: #f4f6f9; }
.mine-title { font-weight: 600; }
.mine-meta { color: var(--pg-muted); font-size: 0.86rem; }
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list a { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid #eef1f5; color: inherit; text-decoration: none; }
.pick-list a:hover { background: #f4f6f9; }
.sku-table td:nth-child(5) { min-width: 240px; }
.sku-table td:nth-child(6) { min-width: 140px; }
.sku-table td:nth-child(-n+4) { min-width: 120px; }
.saved-list { list-style: none; margin: 0; padding: 0; }
.saved-list li { padding: 8px 0; border-bottom: 1px solid #eef1f5; }

@media (max-width: 575.98px) {
    .nav-go { flex-basis: 150px; margin-right: 6px; }
    .app-nav .brand-name { display: none; }
}
@media (max-width: 767.98px) {
    .search-row .btn-lg { padding-left: 14px; padding-right: 14px; }
}

/* ---- Shelf labels (2" x 4", 10 per letter page) ---- */
.label-sheet { display: flex; flex-wrap: wrap; gap: 0.15in; }
.shelf-label { width: 4in; max-width: 100%; height: 2in; box-sizing: border-box; padding: 0.15in 0.18in; background: #fff; border: 1px dashed #c9d1db; border-radius: 6px; display: flex; gap: 0.15in; align-items: center; overflow: hidden; }
.label-text { flex: 1 1 auto; min-width: 0; }
.label-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 30pt; font-weight: 800; line-height: 1.05; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.label-code.is-long { font-size: 22pt; }
.label-code.is-longer { font-size: 16pt; }
.label-title { font-size: 10.5pt; font-weight: 700; margin-top: 6px; line-height: 1.2; max-height: 2.4em; overflow: hidden; }
.label-where { font-size: 8.5pt; color: #444; margin-top: 3px; }
.label-qr { flex: 0 0 1.45in; width: 1.45in; height: 1.45in; }
.label-qr svg { width: 100%; height: 100%; display: block; }

/* ---- Print view ---- */
.print-body { background: #e9edf2; }
.print-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--pg-line); }
.print-bar span { margin-right: auto; color: var(--pg-muted); }
.print-sheet { max-width: 8.5in; margin: 20px auto; background: #fff; padding: 0.5in; box-shadow: 0 2px 12px rgba(28, 37, 48, 0.12); }
.print-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #1c2530; padding-bottom: 10px; margin-bottom: 14px; }
.print-head h1 { font-size: 18pt; margin: 0; font-weight: 700; }
.print-head p { margin: 2px 0 0; color: #444; }
.print-store { text-align: right; font-size: 10pt; }
.print-store div { margin-top: 3px; }
.print-page { display: block; width: 100%; height: auto; margin: 0 auto 14px; border: 1px solid #ddd; }
.print-list h2 { font-size: 13pt; font-weight: 700; margin: 10px 0; }
.print-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.print-table th, .print-table td { border: 1px solid #bbb; padding: 4px 6px; text-align: left; vertical-align: top; }
.print-table th { background: #eef1f5; }

@media print {
    @page { size: letter; margin: 0.4in; }
    body, .print-body, .app-body { background: #fff !important; }
    .app-nav, .d-print-none, .print-bar, .alert { display: none !important; }
    .app-main { padding: 0 !important; max-width: none !important; }
    .print-sheet { margin: 0; padding: 0; box-shadow: none; max-width: none; }
    .print-page { page-break-inside: avoid; break-inside: avoid; border: 0; max-height: 9.6in; width: auto; max-width: 100%; }
    .print-page + .print-page { page-break-before: always; break-before: page; }
    .print-list { page-break-before: always; break-before: page; }
    .print-table tr { page-break-inside: avoid; break-inside: avoid; }
    .label-sheet { display: grid; grid-template-columns: 4in 4in; gap: 0 0.19in; justify-content: center; }
    .shelf-label { max-width: none; }
    .shelf-label { border: 0; border-radius: 0; break-inside: avoid; page-break-inside: avoid; }
    .code-chip { background: #fff !important; color: #000 !important; border: 1px solid #000; }
}
