/* PNS Inventory - app shell and shared components (Bootstrap 5.3 base) */

:root {
	--app-sidebar-w: 250px;
	--app-sidebar-bg: #0f172a;
	--app-sidebar-fg: #cbd5e1;
	--app-sidebar-muted: #64748b;
	--app-sidebar-hover: #1e293b;
	--app-sidebar-active: #1d4ed8;
	--app-bg: #f3f5f8;
	--app-border: #e2e8f0;
	--app-text: #0f172a;
	--app-muted: #64748b;
	--bs-primary: #1d4ed8;
	--bs-primary-rgb: 29, 78, 216;
	--bs-link-color: #1d4ed8;
	--bs-link-color-rgb: 29, 78, 216;
	--bs-body-font-size: .92rem;
}

body.app-body { background: var(--app-bg); color: var(--app-text); }

.btn-primary { --bs-btn-bg: #1d4ed8; --bs-btn-border-color: #1d4ed8; --bs-btn-hover-bg: #1e40af; --bs-btn-hover-border-color: #1e40af; --bs-btn-active-bg: #1e3a8a; --bs-btn-disabled-bg: #1d4ed8; --bs-btn-disabled-border-color: #1d4ed8; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 20px 24px 48px; }
@media (max-width: 575.98px) { .app-content { padding: 14px 12px 40px; } }

/* Sidebar */
.app-sidebar {
	--bs-offcanvas-width: var(--app-sidebar-w);
	--bs-offcanvas-bg: var(--app-sidebar-bg);
	--bs-offcanvas-color: var(--app-sidebar-fg);
	background-color: var(--app-sidebar-bg) !important;
	color: var(--app-sidebar-fg);
}
@media (min-width: 992px) {
	/* Bootstrap sets .offcanvas-lg to a transparent background at this width */
	.app-sidebar { flex: 0 0 var(--app-sidebar-w); width: var(--app-sidebar-w); position: sticky; top: 0; height: 100vh; overflow-y: auto; background-color: var(--app-sidebar-bg) !important; }
}
.app-brand { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid #1e293b; }
.app-brand a { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.app-brand i { color: #60a5fa; font-size: 1.3rem; }
.app-nav { padding: 10px 10px 24px; width: 100%; }
.app-nav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--app-sidebar-muted); padding: 16px 10px 6px; font-weight: 600; }
.app-nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--app-sidebar-fg); text-decoration: none; font-size: .9rem; }
.app-nav-link i { font-size: 1rem; width: 18px; text-align: center; opacity: .85; }
.app-nav-link:hover { background: var(--app-sidebar-hover); color: #fff; }
.app-nav-link.active { background: var(--app-sidebar-active); color: #fff; }
.app-nav-link.active i { opacity: 1; }

/* Top bar */
.app-topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 8px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--app-border); }
@media (max-width: 575.98px) { .app-topbar { padding: 10px 12px; } }
.app-title { font-size: 1.2rem; font-weight: 650; margin: 0; line-height: 1.25; }
.app-subtitle { font-size: .8rem; color: var(--app-muted); }
.app-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.app-user-btn { border: 1px solid var(--app-border); }

/* Cards & panels */
.card { border-color: var(--app-border); border-radius: 8px; }
.card-header { background: #fff; border-bottom-color: var(--app-border); font-weight: 600; padding: 12px 16px; }
.card-header .card-header-actions { float: right; }
.panel-section-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); font-weight: 600; margin-bottom: 8px; }

/* Stat tiles */
.stat-tile { background: #fff; border: 1px solid var(--app-border); border-radius: 8px; padding: 14px 16px; height: 100%; }
.stat-tile .stat-label { font-size: .78rem; color: var(--app-muted); font-weight: 500; }
.stat-tile .stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-tile .stat-note { font-size: .78rem; color: var(--app-muted); margin-top: 2px; }
a.stat-tile { display: block; color: inherit; text-decoration: none; }
a.stat-tile:hover { border-color: #93c5fd; }

/* Tables */
.table-app { margin-bottom: 0; }
.table-app > thead > tr > th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--app-muted); font-weight: 600; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.table-app > tbody > tr > td { vertical-align: middle; }
.table-app .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-app tr.row-muted td { color: var(--app-muted); }
.table-wrap { overflow-x: auto; }
.table-empty { text-align: center; color: var(--app-muted); padding: 28px 12px !important; }
.sku { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Toolbar above tables */
.table-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--app-border); }
.table-toolbar .form-control, .table-toolbar .form-select { max-width: 260px; }
.table-footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--app-border); font-size: .85rem; color: var(--app-muted); }

/* Status badges */
.badge-status { font-weight: 600; font-size: .72rem; padding: .35em .6em; border-radius: 999px; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #e2e8f0; color: #334155; }

/* Qty change arrows */
.qty-change { white-space: nowrap; font-variant-numeric: tabular-nums; }
.qty-change .arrow { color: var(--app-muted); margin: 0 4px; }
.qty-up { color: #15803d; font-weight: 600; }
.qty-down { color: #b91c1c; font-weight: 600; }

/* Scanning stations: big, high-contrast input */
.scan-input { font-size: 1.5rem; padding: .6rem .9rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.scan-flash-ok { animation: flashOk .6s ease-out; }
.scan-flash-bad { animation: flashBad .8s ease-out; }
@keyframes flashOk { from { background-color: #bbf7d0; } to { background-color: transparent; } }
@keyframes flashBad { from { background-color: #fecaca; } to { background-color: transparent; } }

/* Progress */
.progress-thin { height: 8px; }

/* Forms */
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; }
.form-text { font-size: .78rem; }
.required::after { content: " *"; color: #dc2626; }

/* Sticky action bar at the bottom of long edit forms */
.sticky-actions { position: sticky; bottom: 0; z-index: 10; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--app-border); padding: 10px 16px; display: flex; gap: 8px; justify-content: flex-end; }

/* Plain pages (login, install, public invoice) */
body.app-plain { background: var(--app-bg); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 12px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 18px; font-weight: 700; font-size: 1.3rem; }
.auth-brand i { color: #1d4ed8; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; border: 1px solid #dadce0; color: #3c4043; font-weight: 500; padding: .55rem .75rem; }
.btn-google:hover, .btn-google:focus { background: #f8f9fa; border-color: #c6c9cc; color: #202124; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--app-muted); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--app-border); }

/* User avatars (Google profile photos) */
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.user-avatar-sm { width: 22px; height: 22px; }
.user-avatar-blank { display: inline-flex; align-items: center; justify-content: center; background: #e2e8f0; color: #64748b; }

/* Print */
@media print {
	.app-sidebar, .app-topbar, .no-print, .toast-container { display: none !important; }
	.app-content { padding: 0; }
	body.app-body { background: #fff; }
	.card { border: 0; }
}
