/* ==========================================================================
   Tokens copied from the real apps:
   - @retalia/sidebar-navigation (SidebarNavigation/projects/sidebar-navigation)
   - retalia-style.css + dx.generic.Retalia-DX-Theme.css (every *_V2 app)
   - PortalUI login / dashboard
   ========================================================================== */
@font-face { font-family: 'Effra'; src: url('../assets/fonts/Effra_Std_Rg.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Effra'; src: url('../assets/fonts/Effra_Std_Md.woff2') format('woff2'); font-weight: 500 700; font-display: swap; }

:root {
    --topbar-h: 67px;
    --side-collapsed: 72px;
    --side-open: 260px;
    /* sidebar-navigation */
    --nav-active-bg: #fbf9ff;
    --nav-active-text: #545454;
    --nav-inactive-text: #a5a5a5;
    --sidebar-border: #d4d6e4;
    --retalia-blue: #b27bfb;      /* (sic) the library's name for the purple accent */
    --retalia-purple: #5b02c7;
    /* DX Retalia theme */
    --lilac: #c9b5f0;
    --lilac-hover: #baa0ec;
    --lilac-dark: #ad8fe8;
    --dx-border: #ddd;
    --dx-text: #333;
    --dx-muted: #757575;
    --dx-hover: #f5f5f5;
    --dx-alt-row: #f5f5f5;
    --danger: #fe5c73;
    --success: #16dbcc;
    --accent: #b27bfb;
    --border: #ddd;
}

html, body { height: 100%; }
body { margin: 0; background: #f8f8f8; color: var(--dx-text); font-size: 14px; font-family: Inter, -apple-system, BlinkMacSystemFont, "avenir next", avenir, "segoe ui", "helvetica neue", helvetica, arial, sans-serif; }

/* ---------- dx-button look ---------- */
.btn:not(.pui *) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 70px; height: 36px; padding: 0 12px; border-radius: 4px; font-size: 14px; font-weight: 500; line-height: 1.2858; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; cursor: pointer; user-select: none; }
.btn:not(.pui *) svg { width: 16px; height: 16px; }
.btn-primary:not(.pui *) { background: var(--lilac); color: #fff; }
.btn-primary:not(.pui *):hover { background: var(--lilac-hover); }
.btn-secondary:not(.pui *) { background: #fff; border-color: var(--dx-border); color: var(--dx-text); }
.btn-secondary:not(.pui *):hover { background: var(--dx-hover); }
.btn-outline:not(.pui *) { background: transparent; border-color: var(--lilac-hover); color: var(--lilac-hover); }
.btn-outline:not(.pui *):hover { background: rgba(201, 181, 240, .12); }
.btn-ghost:not(.pui *) { background: transparent; color: #575757; min-width: 0; }
.btn-ghost:not(.pui *):hover { background: var(--dx-hover); }
.btn-danger:not(.pui *) { background: var(--danger); color: #fff; }
.btn-danger:not(.pui *):hover { background: #fe2e4c; }
.btn-sm:not(.pui *) { height: 30px; padding: 0 9px; font-size: 13px; min-width: 0; }
.btn:not(.pui *):disabled { opacity: .5; cursor: not-allowed; }
.btn-login:not(.pui *) { background: var(--lilac); color: #000; font-weight: 700; text-transform: uppercase; border-radius: 4px; }
.btn-login:not(.pui *):hover { background: var(--lilac-hover); }

/* ---------- dx-texteditor look ---------- */
.field-label:not(.pui *) { display: block; font-size: 13px; color: #333; margin-bottom: 6px; font-weight: 500; }
.input:not(.pui *), .select:not(.pui *), .textarea:not(.pui *) { width: 100%; min-height: 36px; height: 36px; border: 1px solid var(--dx-border); border-radius: 4px; padding: 7px 9px 8px; font-size: 14px; background: #fff; color: var(--dx-text); outline: none; font-family: inherit; transition: border-color .15s; }
.textarea:not(.pui *) { height: auto; min-height: 84px; }
.input:not(.pui *):hover, .select:not(.pui *):hover, .textarea:not(.pui *):hover { border-color: #c4c4c4; }
.input:not(.pui *):focus, .select:not(.pui *):focus, .textarea:not(.pui *):focus { border-color: var(--lilac); }
.input:not(.pui *):disabled { background: #f5f5f5; color: #959595; }
.input:not(.pui *)::placeholder { color: #999; }
.toggle:not(.pui *) { position: relative; width: 44px; height: 24px; background: #fff; border: 1px solid var(--dx-border); border-radius: 12px; transition: background .2s, border-color .2s; flex-shrink: 0; cursor: pointer; }
.toggle:not(.pui *)::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #c4c4c4; transition: transform .2s, background .2s; }
.toggle:not(.pui *).on { border-color: var(--lilac); }
.toggle:not(.pui *).on::after { transform: translateX(20px); background: var(--lilac); }

/* ---------- panels ---------- */
.card:not(.pui *) { background: #fff; border: 1px solid var(--dx-border); border-radius: 4px; }
.card-soft:not(.pui *) { background: #fff; border: 1px solid #e3e4ed; border-radius: 8px; }

/* dx-data-grid: rowAlternationEnabled, hoverStateEnabled, showBorders=false, showColumnLines=false */
.grid-toolbar:not(.pui *) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 0 10px; }
.tbl:not(.pui *) { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--dx-text); background: #fff; }
.tbl:not(.pui *) th { position: sticky; top: 0; background: #fff; text-align: left; font-weight: 400; color: var(--dx-muted); padding: 7px; border-bottom: 1px solid var(--dx-border); white-space: nowrap; user-select: none; z-index: 1; }
.tbl:not(.pui *) th.sortable { cursor: pointer; }
.tbl:not(.pui *) th.sortable:hover { color: var(--dx-text); }
.tbl:not(.pui *) td { padding: 7px; color: var(--dx-text); white-space: nowrap; }
.tbl:not(.pui *) tbody tr:nth-child(even) td { background: var(--dx-alt-row); }
.tbl:not(.pui *) tbody tr { cursor: pointer; }
.tbl:not(.pui *) tbody tr:hover td { background: #ececec; }
.tbl:not(.pui *) td.num, .tbl:not(.pui *) th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl:not(.pui *) tfoot td { font-weight: 600; border-top: 1px solid var(--dx-border); background: #fff !important; }
.pager:not(.pui *) { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0 0; font-size: 13px; color: var(--dx-text); }
.pager:not(.pui *) .pg:not(.pui *) { min-width: 30px; height: 28px; padding: 0 8px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pager:not(.pui *) .pg:not(.pui *):hover { background: var(--dx-hover); }
.pager:not(.pui *) .pg:not(.pui *).sel { background: #d4d4d4; cursor: default; }

.badge:not(.pui *) { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-size: 12px; font-weight: 500; border-radius: 999px; white-space: nowrap; }
.badge-green:not(.pui *) { background: #d9f7f4; color: #0f8a80; }
.badge-red:not(.pui *) { background: #ffe4e8; color: #c81e3a; }
.badge-amber:not(.pui *) { background: #fff4d6; color: #9a6a00; }
.badge-blue:not(.pui *) { background: #e3effd; color: #1f5fae; }
.badge-purple:not(.pui *) { background: #efe7fd; color: #6a3fc0; }
.badge-gray:not(.pui *) { background: #eeeeee; color: #616161; }

/* dx-tabs */
.tabs:not(.pui *) { display: flex; gap: 0; border-bottom: 1px solid var(--dx-border); overflow-x: auto; scrollbar-width: none; }
.tabs:not(.pui *)::-webkit-scrollbar { display: none; }
.tab:not(.pui *) { white-space: nowrap; flex-shrink: 0; padding: 9px 16px; font-size: 14px; color: var(--dx-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab:not(.pui *):hover { color: var(--dx-text); background: var(--dx-hover); }
.tab:not(.pui *).active { color: var(--dx-text); border-color: var(--lilac); font-weight: 500; }

/* Topbar + sidebar: see src/shell.css (verbatim port of @retalia/sidebar-navigation) */

/* ---------- drawer (dx-popup look) / modal / toast ---------- */
.overlay:not(.pui *) { position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 80; animation: fade .15s ease; }
.drawer:not(.pui *) { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); background: #fff; z-index: 81; display: flex; flex-direction: column; box-shadow: 0 1px 12px rgba(0, 0, 0, .25); animation: slide .2s ease; }
.drawer:not(.pui *).wide { width: min(860px, 100vw); }
.modal:not(.pui *) { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: #fff; border-radius: 4px; z-index: 91; box-shadow: 0 1px 12px rgba(0, 0, 0, .3); animation: pop .15s ease; }
.modal:not(.pui *).wide { width: min(780px, calc(100vw - 32px)); }
#modal-root .overlay:not(.pui *) { z-index: 90; }
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.toast:not(.pui *) { color: #fff; padding: 12px 18px; border-radius: 4px; font-size: 14px; box-shadow: 0 1px 6px rgba(0, 0, 0, .25); display: flex; align-items: center; gap: 8px; animation: toastin .2s ease; background: #04844b; }
.toast:not(.pui *).info { background: #54698d; }
.toast:not(.pui *).err { background: #c23934; }
@keyframes fade { from { opacity: 0 } }
@keyframes slide { from { transform: translateX(40px); opacity: 0 } }
@keyframes pop { from { transform: translate(-50%, -48%); opacity: 0 } }
@keyframes toastin { from { transform: translateY(8px); opacity: 0 } }

/* ---------- page (PortalUI _page.scss / .dx-header-title) ---------- */
.page:not(.pui *) { width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px 24px 48px; }
.page-title { font-weight: 700; font-size: 21px; color: #3f4444; margin: 0; }
@media (max-width: 767px) { .page:not(.pui *) { padding: 12px 16px 32px; } }
.kpi-value:not(.pui *) { font-size: 24px; font-weight: 600; color: #3f4444; font-variant-numeric: tabular-nums; }
.scroll-thin:not(.pui *)::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-thin:not(.pui *)::-webkit-scrollbar-thumb { background: #d4d6e4; border-radius: 8px; }

/* ---------- POS till (POSUI) ---------- */
.pos-key:not(.pui *) { background: #fff; border: 1px solid #d8e0e8; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 500; cursor: pointer; user-select: none; color: #01246c; }
.pos-key:not(.pui *):hover { background: #eef0f2; }
.pos-key:not(.pui *):active { background: #d8e0e8; }

/* ---------- matrix grid (InventoryUI_V2 shared/components/matrix-grid) ---------- */
.mx:not(.pui *) { border-collapse: collapse; width: 100%; font-size: 14px; background: #fff; }
.mx:not(.pui *) th, .mx:not(.pui *) td { border: 1px solid #ddd; text-align: center; padding: 0; min-width: 72px; }
.mx:not(.pui *) th { background: #f2f2f2; font-weight: 600; padding: 7px 8px; white-space: nowrap; }
.mx:not(.pui *) .mx-corner { background: transparent; border-top-color: transparent; border-left-color: transparent; text-align: left; padding: 2px; }
.mx:not(.pui *) .mx-corner select { padding: 2px; font-size: 15px; border: 1px solid transparent; background: transparent; outline: none; cursor: pointer; }
.mx:not(.pui *) .mx-head { background: #f5f5f5; }
.mx:not(.pui *) .mx-rowhead { text-align: left; padding: 5px 10px; white-space: nowrap; min-width: 130px; }
.mx:not(.pui *) .mx-sum { background: #e6e6e6; min-width: 48px; font-weight: 700; padding: 7px 8px; }
.mx:not(.pui *) .mx-empty { background: repeating-linear-gradient(45deg, #fafafa, #fafafa 4px, #f0f0f0 4px, #f0f0f0 8px); }
.mx:not(.pui *) .mx-in, .mx:not(.pui *) .mx-ro { display: block; width: 100%; min-width: 72px; text-align: center; border: 0; outline: 0; padding: 8px; background: transparent; font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.mx:not(.pui *) .mx-in:focus { background: #fbf9ff; cursor: text; }
.mx:not(.pui *) td.mx-diff { background: #efe7fd; }
.mx:not(.pui *) td.mx-new { background: #fff1dc; }
.mx:not(.pui *) td.mx-new .mx-in, .mx:not(.pui *) td.mx-new .mx-ro { color: #c77700; }
.mx:not(.pui *) td.mx-sel { box-shadow: inset 0 0 0 2px #b27bfb; }
.mx:not(.pui *) select.mx-in { appearance: auto; padding: 7px 4px; font-size: 13px; cursor: pointer; }
.mx:not(.pui *) .mx-in.mx-text { text-align: left; min-width: 130px; font-size: 13px; }
.mx:not(.pui *) td.mx-sel .mx-in, .mx:not(.pui *) td.mx-sel .mx-ro { background: #fbf9ff; }
.mx:not(.pui *) label.mx-ro { cursor: pointer; }

/* Shop Select popup (sidebar-navigation shop-modal) + topbar shop button */
.shop-btn:not(.pui *) { text-align: left; border-radius: 5px; padding: 10px 12px; background: #f5f5f5; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s; color: #333; min-width: 0; }
.shop-btn:not(.pui *):hover { background: #efe7fd; border-color: #c9b5f0; }
.shop-btn:not(.pui *).is-current { border-color: #b27bfb; background: #fbf9ff; }
.shop-pill:not(.pui *) { display: inline-flex; align-items: center; gap: 8px; height: 36px; max-width: 240px; padding: 0 12px; border-radius: 18px; border: 1px solid #d4d6e4; background: #fff; color: #545454; font-family: Poppins, sans-serif; font-size: 13px; cursor: pointer; transition: .2s linear; }
.shop-pill:not(.pui *):hover { border-color: #b27bfb; color: #282727; }
@media (max-width: 600px) { .shop-pill span { display: none; } }
