/*
 * eShop screen refinements, loaded after the main stylesheet as a plain file (no build step):
 * light and dark themes, highlighted scroll bars, the collapsible menu, the feature map,
 * stat cards and small charts.
 */
:root {
    --es-surface: #fff;
    --es-line: #e3e8e9;
    --es-muted: #6c7a89;
    --es-scroll: #0d6e6e;
    --es-scroll-hover: #f2a03d;
    --es-scroll-track: #e2ecec;
    --es-chart-main: #0d6e6e;
    --es-chart-second: #f2a03d;
    --es-chart-third: #8fb8b7;
}

/* ------------------------------------------------------------------ scroll bars */
* { scrollbar-width: thin; scrollbar-color: var(--es-scroll) var(--es-scroll-track); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--es-scroll-track); border-radius: 8px; }
::-webkit-scrollbar-thumb { background: var(--es-scroll); border-radius: 8px; border: 2px solid var(--es-scroll-track); min-height: 28px; }
::-webkit-scrollbar-thumb:hover { background: var(--es-scroll-hover); }
::-webkit-scrollbar-corner { background: var(--es-scroll-track); }
/* The arrow buttons at both ends: brand colour with white arrows. */
::-webkit-scrollbar-button:single-button { display: block; background-color: var(--es-scroll); background-repeat: no-repeat; background-position: center; background-size: 7px; border-radius: 4px; }
::-webkit-scrollbar-button:single-button:hover { background-color: var(--es-scroll-hover); }
::-webkit-scrollbar-button:single-button:vertical { height: 13px; }
::-webkit-scrollbar-button:single-button:horizontal { width: 13px; }
::-webkit-scrollbar-button:single-button:vertical:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 2 9 8H1z' fill='white'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:vertical:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 8 9 2H1z' fill='white'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5 8 1v8z' fill='white'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M8 5 2 1v8z' fill='white'/%3E%3C/svg%3E"); }
.es-sidebar { scrollbar-color: var(--es-accent) var(--es-sidebar); }
.es-sidebar::-webkit-scrollbar-track, .es-sidebar::-webkit-scrollbar-corner { background: var(--es-sidebar); }
.es-sidebar::-webkit-scrollbar-thumb { background: var(--es-accent); border-color: var(--es-sidebar); }
.es-sidebar::-webkit-scrollbar-button:single-button { background-color: #1d4a50; }

/* ------------------------------------------------------------------ collapsible menu with search */
.es-sidebar .nav-search { padding: 0 .9rem .6rem; }
.es-sidebar .nav-search input { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); color: #fff; font-size: .88rem; }
.es-sidebar .nav-search input::placeholder { color: rgba(201, 220, 220, .65); }
.es-sidebar .nav-search input:focus { background: rgba(255, 255, 255, .12); border-color: var(--es-accent); box-shadow: none; color: #fff; }
.es-sidebar .nav-section.toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; width: 100%; background: none; border: 0; color: inherit; text-align: left; }
.es-sidebar .nav-section.toggle:hover { opacity: .9; }
.es-sidebar .nav-section .chev { font-size: .7rem; transition: transform .15s; }
.es-sidebar .nav-group.collapsed .nav-items { display: none; }
.es-sidebar .nav-group.collapsed .chev { transform: rotate(-90deg); }
.es-sidebar .nav-group .count { font-size: .65rem; opacity: .7; margin-left: auto; margin-right: .4rem; }
.es-sidebar .nav-empty { padding: .4rem 1.1rem; font-size: .85rem; opacity: .7; display: none; }

/* ------------------------------------------------------------------ feature map */
.feature-map .fm-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--es-muted); margin: .25rem 0 .4rem; font-weight: 600; }
.feature-tile { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .65rem; border: 1px solid var(--es-line); border-radius: .6rem; background: var(--es-surface); color: inherit; text-decoration: none; height: 100%; transition: border-color .1s, box-shadow .1s, transform .05s; }
.feature-tile:hover, .feature-tile:focus { border-color: var(--es-brand); box-shadow: 0 2px 10px rgba(13, 110, 110, .12); color: inherit; }
.feature-tile:active { transform: scale(.99); }
.feature-tile .fi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--es-brand-soft); color: var(--es-brand); font-size: 1.05rem; flex-shrink: 0; }
.feature-tile .fl { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.feature-tile .fd { font-size: .76rem; color: var(--es-muted); line-height: 1.25; margin-top: .1rem; }

/* ------------------------------------------------------------------ stat cards and small charts */
.stat-card { border-left: 4px solid var(--es-brand); }
.stat-card.stat-in { border-left-color: #2e9e6b; }
.stat-card.stat-out { border-left-color: var(--es-accent); }
.stat-card.stat-warn { border-left-color: #d64545; }
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--es-muted); font-weight: 600; }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1.2; margin: .15rem 0; }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.mini-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.mini-bar-stack { width: 100%; max-width: 30px; display: flex; flex-direction: column; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; background: var(--es-line); }
.mini-bar-stack .seg { display: block; width: 100%; }
.mini-bar .pair { width: 42%; max-width: 14px; border-radius: 3px 3px 0 0; min-height: 2px; display: block; }
.mini-bar-label { font-size: .68rem; color: var(--es-muted); margin-top: 3px; white-space: nowrap; }
.seg-main { background: var(--es-chart-main); }
.seg-demo { background: var(--es-chart-third); }
.seg-shop { background: var(--es-chart-second); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; }

/* ------------------------------------------------------------------ small polish */
.page-head h1 { letter-spacing: -.01em; }
.card { border-radius: .7rem; }
.card > .card-header:first-child { border-radius: .7rem .7rem 0 0; }
.nav-tabs .nav-link { color: var(--es-muted); font-weight: 600; }
.nav-tabs .nav-link.active { color: var(--es-brand); border-bottom-color: transparent; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: rgba(13, 110, 110, .05); }
.theme-switch .dropdown-item.active, .theme-switch .dropdown-item:active { background: var(--es-brand); }

/* ------------------------------------------------------------------ dark theme */
[data-bs-theme="dark"] {
    --bs-body-bg: #0e1a1c;
    --bs-body-color: #dce6e7;
    --bs-secondary-bg: #16262a;
    --bs-tertiary-bg: #13221f;
    --bs-border-color: #26393d;
    --bs-link-color: #52c4c0;
    --bs-link-color-rgb: 82, 196, 192;
    --bs-link-hover-color: #84d9d6;
    --es-ink: #dce6e7;
    --es-brand-soft: #143a3d;
    --es-surface: #15252a;
    --es-line: #26393d;
    --es-muted: #93a6ac;
    --es-scroll: #2c9b97;
    --es-scroll-track: #18282c;
    --es-chart-main: #2fb3ad;
    --es-chart-third: #3d6b6d;
}
[data-bs-theme="dark"] body { background: var(--bs-body-bg); color: var(--bs-body-color); }
[data-bs-theme="dark"] .es-topbar { background: #13221f; border-bottom-color: var(--es-line); }
[data-bs-theme="dark"] .card, [data-bs-theme="dark"] .filter-bar, [data-bs-theme="dark"] .pos .product-tile, [data-bs-theme="dark"] .pos .cart,
[data-bs-theme="dark"] .list-group-item, [data-bs-theme="dark"] .modal-content, [data-bs-theme="dark"] .dropdown-menu { background: var(--es-surface); border-color: var(--es-line); color: var(--bs-body-color); }
[data-bs-theme="dark"] .card-header, [data-bs-theme="dark"] .card-footer { background: #182b30; border-color: var(--es-line); }
[data-bs-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-color: var(--bs-body-color); --bs-table-border-color: var(--es-line); }
[data-bs-theme="dark"] .table thead th { background: #1a2e33; color: #9fb4ba; }
[data-bs-theme="dark"] .kpi .label, [data-bs-theme="dark"] .page-head .sub, [data-bs-theme="dark"] .help-text, [data-bs-theme="dark"] .empty-state, [data-bs-theme="dark"] .text-muted { color: var(--es-muted) !important; }
[data-bs-theme="dark"] .text-primary { color: #52c4c0 !important; }
[data-bs-theme="dark"] .bg-brand-soft { background: #0f2427; }
[data-bs-theme="dark"] .btn-light { --bs-btn-bg: #1d3236; --bs-btn-color: #dce6e7; --bs-btn-border-color: #2c464b; --bs-btn-hover-bg: #26424a; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #36575d; --bs-btn-active-bg: #26424a; --bs-btn-active-color: #fff; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #52c4c0; --bs-btn-border-color: #2c9b97; --bs-btn-hover-bg: #2c9b97; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #2c9b97; }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #b8c7cb; --bs-btn-border-color: #3b5257; --bs-btn-hover-bg: #2a4045; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select, [data-bs-theme="dark"] .input-group-text { background-color: #102024; border-color: #2c4247; color: var(--bs-body-color); }
[data-bs-theme="dark"] .form-control::placeholder { color: #6f858b; }
[data-bs-theme="dark"] .text-bg-light { background-color: #233a3f !important; color: #dce6e7 !important; }
[data-bs-theme="dark"] .alert-info { background: #10333a; border-color: #1d5560; color: #bfe6ee; }
[data-bs-theme="dark"] .alert-light { background: #172a2e; border-color: var(--es-line); color: var(--bs-body-color); }
[data-bs-theme="dark"] .nav-tabs { border-color: var(--es-line); }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { background: var(--es-surface); border-color: var(--es-line) var(--es-line) transparent; color: #52c4c0; }
[data-bs-theme="dark"] .receipt, [data-bs-theme="dark"] .receipt * { background: #fff; color: #000; }
@media print { [data-bs-theme="dark"] body { background: #fff; color: #000; } }

/* While searching the menu, every section with a match is open. */
.es-sidebar.searching .nav-group.search-open .nav-items { display: block; }

/* ---------------------------------------------------------------- phones and the Android app: bottom bar */
.es-bottom-nav { display: none; }
@media (max-width: 991.98px) {
    .es-bottom-nav {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
        background: var(--es-surface); border-top: 1px solid var(--es-line);
        padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(15, 43, 47, .08);
    }
    .es-bottom-nav a, .es-bottom-nav button {
        flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 7px 2px 8px; font-size: .7rem; line-height: 1.1; color: var(--es-muted); text-decoration: none;
        background: none; border: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .es-bottom-nav i { font-size: 1.3rem; line-height: 1; }
    .es-bottom-nav .active { color: var(--es-scroll); font-weight: 600; }
    .es-bottom-nav .active i { transform: translateY(-1px); }
    body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
}
@media print { .es-bottom-nav { display: none !important; } }

/* Product pictures on the till tiles */
.pos .product-tile .tile-img { display: block; width: 100%; height: 72px; object-fit: contain; margin-bottom: .35rem; border-radius: .4rem; }

/* A save bar that stays in view while a long form scrolls; above the phone bottom bar */
.save-bar { position: sticky; bottom: 0; z-index: 5; }
@media (max-width: 991.98px) { .save-bar { bottom: calc(58px + env(safe-area-inset-bottom)); } }

/* Freeze panes: in a long list or report the column titles stay at the top (and a total row at the bottom)
   while the rows scroll underneath, like freezing the top row in Excel. */
.table-responsive:not(.no-freeze) { max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); overflow: auto; }
.table-responsive:not(.no-freeze) > .table > thead > tr > th { position: sticky; top: 0; z-index: 3; box-shadow: inset 0 -1px 0 #d9e1e2; }
.table-responsive:not(.no-freeze) > .table > tfoot > tr > * { position: sticky; bottom: 0; z-index: 2; background: var(--bs-body-bg, #fff); box-shadow: inset 0 1px 0 #c9d3d5; }
@media (max-width: 991.98px) {
    .table-responsive:not(.no-freeze) { max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px - env(safe-area-inset-bottom)); }
}
[data-bs-theme="dark"] .table-responsive:not(.no-freeze) > .table > thead > tr > th { box-shadow: inset 0 -1px 0 #2c4349; }
@media print { .table-responsive, .table-responsive:not(.no-freeze) { max-height: none !important; overflow: visible !important; } }

/* Till keyboard use: the match Enter adds, and the cart line + and - change */
.pos .product-tile.picked { border-color: var(--es-brand); box-shadow: 0 0 0 .2rem rgba(13, 110, 110, .25); }
.pos .cart-line.current { background: rgba(13, 110, 110, .07); box-shadow: inset 3px 0 0 var(--es-brand); }
.pos .pos-keys kbd { font-size: .7rem; padding: .05rem .3rem; margin: 0 .05rem; }
@media (max-width: 767.98px) { .pos .pos-keys { display: none; } }

/* Card photo framing: the same shape as the 19 x 24 mm photo box on the printed card */
.idp-frame { position: relative; width: 152px; height: 192px; overflow: hidden; flex: none; border-radius: .35rem; background: #eef1f2;
    border: 1px solid #c9d3d5; cursor: grab; touch-action: none; user-select: none; }
.idp-frame:active { cursor: grabbing; }
.idp-frame img { position: absolute; max-width: none; pointer-events: none; }

/* Report heading: on paper it replaces the page title and filters */
@media print { .report-heading { border: 0 !important; } .report-heading .card-body { padding: 0 0 6px !important; border-bottom: 1px solid #000; margin-bottom: 8px; }
  main:has(.report-heading) .page-head { display: none !important; } }
