/* App shell layout + page-specific styles */
#app { display: grid; grid-template-rows: 44px 1fr; grid-template-columns: 240px 1fr; height: 100vh; transition: grid-template-columns .25s var(--ease); }
#app.collapsed { grid-template-columns: 72px 1fr; }

/* titlebar */
.titlebar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 0 0 14px; -webkit-app-region: drag; background: var(--sidebar); border-bottom: 1px solid var(--border); backdrop-filter: blur(20px); }
.titlebar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; box-shadow: 0 4px 12px rgba(99,102,241,.45), inset 0 1px 0 rgba(255,255,255,.4); }
.titlebar .center { display: flex; align-items: center; gap: 10px; -webkit-app-region: no-drag; }
.titlebar .global-search { width: 380px; } .titlebar .global-search .input { height: 32px; border-radius: 9px; }
.win-controls { display: flex; height: 100%; -webkit-app-region: no-drag; } .win-controls button { width: 46px; height: 100%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; display: grid; place-items: center; } .win-controls button:hover { background: var(--surface-2); color: var(--text); } .win-controls button.close:hover { background: #e11d48; color: #fff; } .win-controls .ico { width: 14px; height: 14px; }
.web .win-controls { display: none; } .web .titlebar { -webkit-app-region: no-drag; }
.demo-badge { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #f59e0b, #ec4899); box-shadow: 0 4px 12px rgba(236,72,153,.35), inset 0 1px 0 rgba(255,255,255,.35); white-space: nowrap; }
.sync-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); -webkit-app-region: no-drag; cursor: pointer; } .sync-pill .ico { width: 15px; height: 15px; } .sync-pill.ok .dot { background: var(--success); box-shadow: 0 0 8px var(--success); } .sync-pill.err .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); } .sync-pill.local .dot { background: var(--info); } .sync-pill.busy .ico { animation: spin 1s linear infinite; }

/* sidebar */
.sidebar { display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border); backdrop-filter: blur(20px); padding: 12px 10px; gap: 4px; overflow: hidden auto; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px; color: var(--text-2); font-weight: 550; cursor: pointer; border: 1px solid transparent; transition: all .18s var(--ease); white-space: nowrap; user-select: none; position: relative; }
.nav-item .ico { width: 20px; height: 20px; flex: none; } .nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(99,102,241,.35), inset 0 1px 0 rgba(255,255,255,.3); border-color: transparent; }
.nav-item .pill { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(239,68,68,.9); color: #fff; }
.nav-sec { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 4px; font-weight: 700; white-space: nowrap; }
.collapsed .nav-item { justify-content: center; padding: 0; } .collapsed .nav-item span.lbl, .collapsed .nav-sec, .collapsed .nav-item .pill, .collapsed .user-box .meta { display: none; }
.sidebar .spacer { flex: 1; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); } .user-box .meta { min-width: 0; line-height: 1.2; } .user-box .meta b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .user-box .meta span { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.collapse-btn { align-self: center; margin-top: 6px; } .collapsed .collapse-btn .ico { transform: rotate(180deg); }

/* main */
.main { overflow: auto; padding: 22px 26px 30px; animation: fadeUp .3s var(--ease); min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; } .page-head p { margin-top: 3px; font-size: 13px; } .page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-21 { grid-template-columns: 2fr 1fr; } .grid-12 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1280px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-21, .grid-12 { grid-template-columns: 1fr; } }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; } .toolbar .search { min-width: 260px; flex: 1; max-width: 420px; } .toolbar select.input { width: auto; min-width: 150px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); } .list-item:last-child { border-bottom: 0; } .list-item .meta { flex: 1; min-width: 0; } .list-item .meta b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .list-item .meta span { font-size: 12px; color: var(--muted); } .list-item .amt { font-weight: 650; white-space: nowrap; }
.emoji { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-3); display: grid; place-items: center; font-size: 20px; flex: none; border: 1px solid var(--border); overflow: hidden; }
.emoji.has-img { background: #fff; } .emoji img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ptile .pthumb { width: 100%; height: 96px; flex: none; border-radius: 12px; background: #fff; overflow: hidden; display: block; border: 1px solid var(--border); }
.ptile .pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-picker { display: flex; gap: 14px; align-items: center; } .img-picker .preview { width: 96px; height: 96px; border-radius: 16px; background: var(--surface-3); border: 1px dashed var(--border-2); display: grid; place-items: center; font-size: 40px; overflow: hidden; flex: none; } .img-picker .preview img { width: 100%; height: 100%; object-fit: cover; } .img-picker input[type=file] { display: none; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; } .legend div { display: flex; align-items: center; gap: 8px; } .legend .dot { width: 10px; height: 10px; } .legend b { margin-left: auto; }

/* login */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 900; background: var(--bg); }
#login[hidden] { display: none; }
#login::before { content: ""; position: absolute; inset: 0; background: radial-gradient(800px 500px at 20% 20%, var(--blob-1), transparent 60%), radial-gradient(700px 500px at 80% 80%, var(--blob-2), transparent 60%), radial-gradient(600px 400px at 70% 10%, var(--blob-3), transparent 60%); }
.login-card { position: relative; width: 420px; padding: 36px; text-align: center; animation: fadeUp .5s var(--ease); }
.login-card .brand-mark { width: 60px; height: 60px; border-radius: 18px; font-size: 26px; margin: 0 auto 16px; }
.login-card h1 { font-size: 26px; } .login-card .muted { margin: 6px 0 24px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 18px 0; } .pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-2); transition: all .15s; } .pin-dots i.on { background: var(--grad); border-color: transparent; box-shadow: 0 0 10px rgba(99,102,241,.6); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; } .pin-pad button { height: 54px; border-radius: 14px; font-size: 20px; font-weight: 600; }
.user-pick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; } .user-pick button { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-weight: 550; } .user-pick button.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.25); } .user-pick .avatar { width: 26px; height: 26px; font-size: 10px; border-radius: 50%; }
.login-card .hint { font-size: 12px; margin-top: 18px; }

/* dashboard */
.dash-kpis { margin-bottom: 16px; }
.chart-card .card-body { padding-top: 8px; }

/* POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; height: calc(100vh - 44px - 44px); } .main.pos-main { padding: 22px 26px; overflow: hidden; }
.pos-left { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; } .pos-top { display: flex; gap: 10px; align-items: center; } .pos-top .search { flex: 1; } .pos-top .search .input { height: 44px; border-radius: 13px; font-size: 15px; }
.cat-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; flex: none; } .cat-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap; transition: all .18s; font-size: 13px; } .cat-chip:hover { background: var(--surface-3); } .cat-chip.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(99,102,241,.35); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: max-content; gap: 12px; overflow: auto; padding: 2px; flex: 1; align-content: start; }
.ptile { position: relative; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: all .18s var(--ease); display: flex; flex-direction: column; gap: 6px; min-height: 130px; overflow: hidden; backdrop-filter: blur(14px); }
.ptile::before { content: ""; position: absolute; inset: 0; background: var(--gloss); opacity: .5; pointer-events: none; }
.ptile:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: 0 12px 26px rgba(0,0,0,.25); background: var(--surface-2); } .ptile:active { transform: scale(.97); }
.ptile .emoji { width: 44px; height: 44px; font-size: 24px; border-radius: 13px; } .ptile .name { font-weight: 600; font-size: 13.5px; line-height: 1.3; min-height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } .ptile .price { margin-top: auto; font-weight: 700; font-size: 15px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ptile .stock { position: absolute; top: 10px; right: 10px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); } .ptile .stock.low { background: rgba(245,158,11,.2); color: #fbbf24; } .ptile .stock.out { background: rgba(239,68,68,.2); color: #f87171; } .ptile.out { opacity: .5; }
.cart { display: flex; flex-direction: column; min-height: 0; } .cart-head { padding: 14px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border); }
.cart-customer { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); } .cart-customer select { flex: 1; }
.cart-items { flex: 1; overflow: auto; padding: 6px 10px; } .cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 9px 6px; border-bottom: 1px solid var(--border); align-items: center; animation: fadeUp .2s var(--ease); } .cart-line:last-child { border-bottom: 0; }
.cart-line .n { font-weight: 600; font-size: 13.5px; } .cart-line .s { font-size: 12px; color: var(--muted); } .cart-line .t { font-weight: 700; text-align: right; }
.qty { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; } .qty button { width: 26px; height: 26px; border: 0; background: transparent; color: var(--text); border-radius: 7px; cursor: pointer; display: grid; place-items: center; } .qty button:hover { background: var(--surface-3); } .qty button .ico { width: 14px; height: 14px; } .qty input { width: 48px; height: 26px; text-align: center; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; outline: none; }
.cart-totals { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; } .cart-totals div { display: flex; justify-content: space-between; align-items: center; } .cart-totals .grand { font-size: 22px; font-weight: 800; margin-top: 4px; } .cart-totals .grand span:last-child { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cart-totals input { width: 110px; text-align: right; }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 16px; } .cart-actions .pay { grid-column: 1 / -1; }
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 14px; } .pay-grid button { height: 44px; } .pay-grid button.active { background: var(--grad); color: #fff; border-color: transparent; }
.big-amount { font-size: 34px; font-weight: 800; text-align: center; margin: 4px 0 12px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; } .pay-lines { display: flex; flex-direction: column; gap: 8px; } .pay-line { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.change-box { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 650; margin-top: 10px; } .change-box.due { border-color: rgba(245,158,11,.4); color: #fbbf24; } .change-box.change { border-color: rgba(34,197,94,.4); color: #4ade80; }

/* sales detail */
.sale-detail .items { margin: 12px 0; }
.status-held { opacity: .9; }

/* settings */
.settings-nav { display: flex; flex-direction: column; gap: 4px; } .settings-nav button { text-align: left; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 550; cursor: pointer; } .settings-nav button.active { background: var(--surface-3); color: var(--text); } .settings-nav button:hover { color: var(--text); }
.source-card { padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: all .2s; display: flex; gap: 12px; align-items: flex-start; } .source-card:hover { border-color: var(--border-2); } .source-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.25); } .source-card .ico { width: 24px; height: 24px; color: var(--accent-3); flex: none; margin-top: 2px; } .source-card b { display: block; margin-bottom: 3px; } .source-card p { font-size: 12.5px; color: var(--muted); }

/* reports */
.report-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* print preview hidden */
.receipt-preview { background: #fff; color: #000; border-radius: 10px; padding: 12px; font-family: var(--mono); font-size: 12px; max-height: 420px; overflow: auto; }

/* stock levels bar */
.level { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; margin-right: 8px; } .level i { display: block; height: 100%; border-radius: 4px; background: var(--success); } .level i.low { background: var(--warning); } .level i.out { background: var(--danger); }

@media (max-width: 1100px) { .pos { grid-template-columns: 1fr 340px; } .titlebar .global-search { width: 240px; } }

/* badge over photos (after the base .stock rule so it wins) */
.ptile.has-photo .stock { backdrop-filter: blur(6px); background: rgba(15,23,42,.6); color: #fff; }
