:root {
	--sidebar-bg: #1e1e2d;
	--sidebar-text: #a2a3b7;
	--sidebar-active: #ffffff;
	--sidebar-active-bg: #2b2b40;
	--bg-main: #f5f8fa;
	--card-bg: #ffffff;
	--text-color: #3f4254;
	--text-muted: #b5b5c3;
	--primary: #c94a5a;
	--success: #1bc5bd;
	--warning: #ffa800;
	--danger: #f64e60;
	--border: #ebedf3;
	--radius: 10px;
	--shadow: 0 0 20px 0 rgba(76,87,125,0.05);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
	font-family: var(--font);
	background: var(--bg-main);
	color: var(--text-color);
	display: flex;
	height: 100vh;
	overflow: hidden;
}

/* Sidebar */
.sidebar {
	width: 250px;
	background: var(--sidebar-bg);
	display: flex;
	flex-direction: column;
}
.sidebar-brand {
	padding: 20px 18px;
	color: #ffffff;
	font-size: 1.15rem;
	font-weight: 800;
	border-bottom: 1px solid rgba(255,255,255,0.08);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}
.btn-sidebar-close {
	display: none;
	background: rgba(255, 255, 255, 0.12);
	border: none;
	color: #ffffff;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	font-size: 1.4rem;
	line-height: 1;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s;
}
.btn-sidebar-close:hover {
	background: rgba(255, 255, 255, 0.25);
}
.btn-sidebar-toggle {
	display: none;
	flex-direction: column;
	justify-content: space-around;
	width: 38px;
	height: 38px;
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 8px 7px;
	cursor: pointer;
	flex-shrink: 0;
}
.btn-sidebar-toggle span {
	display: block;
	width: 100%;
	height: 2.5px;
	background: #1e1e2d;
	border-radius: 2px;
}
.sidebar-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	z-index: 1040;
	opacity: 0;
	transition: opacity 0.25s ease;
}
.sidebar-backdrop.active {
	display: block;
	opacity: 1;
}
.sidebar-menu {
	list-style: none;
	padding: 20px 10px;
	flex: 1;
	overflow-y: auto;
}
.sidebar-menu li {
	margin-bottom: 6px;
}
.sidebar-menu a {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	color: var(--sidebar-text);
	text-decoration: none;
	font-size: 0.95rem;
	font-weight: 600;
	border-radius: var(--radius);
	transition: all 0.2s;
}
.sidebar-menu a:hover, .sidebar-menu a.active {
	background: var(--sidebar-active-bg);
	color: var(--sidebar-active);
}
.sidebar-footer {
	padding: 16px;
	border-top: 1px solid rgba(255,255,255,0.05);
}
.sidebar-footer a {
	color: var(--sidebar-text);
	text-decoration: none;
	font-size: 0.85rem;
}

/* Main Content Area */
.main-wrapper {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}
.topbar {
	background: #ffffff;
	border-bottom: 1px solid var(--border);
	padding: 16px 32px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.topbar h2 {
	font-size: 1.4rem;
	font-weight: 700;
}
.content {
	padding: 32px;
	flex: 1;
}

/* Cards & Stats */
.metrics-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 20px;
	margin-bottom: 30px;
}
.metric-card {
	background: var(--card-bg);
	border-radius: var(--radius);
	padding: 20px;
	box-shadow: var(--shadow);
	border: 1px solid var(--border);
	display: flex;
	flex-direction: column;
}
.metric-label {
	font-size: 0.85rem;
	color: var(--text-muted);
	font-weight: 600;
	text-transform: uppercase;
	margin-bottom: 8px;
}
.metric-val {
	font-size: 1.8rem;
	font-weight: 800;
	color: var(--text-color);
}
.metric-sub {
	font-size: 0.85rem;
	margin-top: 6px;
}
.metric-sub.danger { color: var(--danger); }
.metric-sub.success { color: var(--success); }

/* Table Container */
.data-card {
	background: var(--card-bg);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	border: 1px solid var(--border);
	margin-bottom: 30px;
	overflow: hidden;
}
.data-card-header {
	padding: 20px 24px;
	border-bottom: 1px solid var(--border);
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.data-card-header h3 {
	font-size: 1.15rem;
	font-weight: 700;
}
.btn-action {
	background: var(--primary);
	color: #fff;
	border: none;
	padding: 8px 18px;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.9rem;
	cursor: pointer;
	text-decoration: none;
	display: inline-block;
}
.btn-action:hover { opacity: 0.9; }

/* Responsive Table */
.table-responsive {
	overflow-x: auto;
}
table.custom-table {
	width: 100%;
	border-collapse: collapse;
	text-align: left;
}
table.custom-table th {
	background: #fafbfc;
	padding: 12px 24px;
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--text-muted);
	border-bottom: 1px solid var(--border);
}
table.custom-table td {
	padding: 14px 24px;
	border-bottom: 1px solid var(--border);
	font-size: 0.95rem;
}
table.custom-table tr:hover {
	background: #fcfdfe;
}

/* Badges */
.badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 50px;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
}
.badge-success { background: #e8fff3; color: var(--success); }
.badge-warning { background: #fff8dd; color: var(--warning); }
.badge-danger { background: #ffe2e5; color: var(--danger); }
.badge-info { background: #e1f0ff; color: #3699ff; }

/* Formulários */
.form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
	margin-bottom: 20px;
}
.form-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.form-group label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text-color);
}
.form-control {
	padding: 10px 14px;
	border: 1px solid var(--border);
	border-radius: 6px;
	font-size: 0.95rem;
	outline: none;
}
.form-control:focus {
	border-color: var(--primary);
}

/* Modal Admin */
.admin-modal-overlay {
	display: none;
	position: fixed;
	top: 0; left: 0; width: 100%; height: 100%;
	background: rgba(0,0,0,0.5);
	z-index: 500;
	justify-content: center;
	align-items: center;
	padding: 20px;
}
.admin-modal {
	background: #fff;
	border-radius: 12px;
	max-width: 550px;
	width: 100%;
	padding: 28px;
}

/* Logo e Topbar */
.admin-sidebar-logo {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255,255,255,0.2);
}
.btn-logout {
	padding: 6px 14px;
	background: #fff;
	color: var(--primary);
	border: 1px solid var(--border);
	border-radius: 6px;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.85rem;
	transition: 0.2s;
}
.btn-logout:hover {
	background: #ffe3e6;
	color: #b03a49;
}

/* Leitor de Código de Barras (Câmera) */
.input-with-scanner {
	display: flex;
	gap: 8px;
}
.input-with-scanner input {
	flex: 1;
}
.btn-scanner {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: var(--primary);
	color: #ffffff;
	border: none;
	border-radius: 6px;
	padding: 0 14px;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.85rem;
	white-space: nowrap;
	transition: background 0.2s, transform 0.1s;
}
.btn-scanner:hover {
	background: var(--primary-hover, #b03a49);
}
.btn-scanner:active {
	transform: scale(0.98);
}

.scanner-modal {
	max-width: 440px;
	text-align: center;
}
.video-container {
	position: relative;
	width: 100%;
	height: 280px;
	background: #111;
	border-radius: 10px;
	overflow: hidden;
	margin-bottom: 12px;
}
#scannerVideo {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.scanner-target-box {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 80%;
	height: 55%;
	border: 2px solid #00f0ff;
	border-radius: 8px;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
	pointer-events: none;
}
.scan-laser {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 3px;
	background: #ff0055;
	box-shadow: 0 0 10px #ff0055, 0 0 4px #fff;
	animation: laserScan 2s infinite ease-in-out;
}
@keyframes laserScan {
	0% { top: 5%; opacity: 0.8; }
	50% { top: 92%; opacity: 1; }
	100% { top: 5%; opacity: 0.8; }
}
.scanner-status {
	font-size: 0.88rem;
	color: var(--text-muted);
	margin-bottom: 14px;
	font-weight: 500;
}
.scanner-controls {
	display: flex;
	justify-content: center;
	gap: 10px;
}

/* Modal e Abas de Importação Fiscal NFC-e / NF-e */
.nfce-tab-btn {
	background: none;
	border: none;
	padding: 8px 16px;
	font-size: 0.9rem;
	font-weight: 600;
	color: #64748b;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	transition: all 0.2s;
	border-radius: 6px 6px 0 0;
}
.nfce-tab-btn:hover {
	color: #4f46e5;
	background: #f1f5f9;
}
.nfce-tab-btn.active {
	color: #4f46e5;
	border-bottom: 2px solid #4f46e5;
	background: #eef2ff;
}
.nfce-summary-card {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 16px;
	margin-bottom: 16px;
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: center;
	justify-content: space-between;
}
.nfce-badge-uf {
	background: #3b82f6;
	color: #fff;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.8rem;
}
.badge-match-ean {
	background: #d1fae5;
	color: #065f46;
	padding: 3px 8px;
	border-radius: 6px;
	font-size: 0.78rem;
	font-weight: 600;
}
.badge-match-nome {
	background: #fef3c7;
	color: #92400e;
	padding: 3px 8px;
	border-radius: 6px;
	font-size: 0.78rem;
	font-weight: 600;
}
.badge-match-novo {
	background: #e0e7ff;
	color: #3730a3;
	padding: 3px 8px;
	border-radius: 6px;
	font-size: 0.78rem;
	font-weight: 600;
}

/* Gestão de Produtos e Vitrine */
.btn-toggle-destaque {
	padding: 5px 12px;
	border-radius: 20px;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
}
.btn-toggle-destaque.destaque-on {
	background: #ecfdf5;
	color: #065f46;
	border-color: #a7f3d0;
}
.btn-toggle-destaque.destaque-on:hover {
	background: #d1fae5;
	border-color: #6ee7b7;
}
.btn-toggle-destaque.destaque-off {
	background: #f1f5f9;
	color: #64748b;
	border-color: #cbd5e1;
}
.btn-toggle-destaque.destaque-off:hover {
	background: #e2e8f0;
	color: #334155;
}
.admin-prod-thumb {
	width: 48px;
	height: 48px;
	border-radius: 8px;
	object-fit: cover;
	border: 1px solid #ebedf3;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ========================================================================= */
/* ADAPTAÇÃO RESPONSIVA COMPLETA PARA O PAINEL ADMIN EM CELULARES             */
/* ========================================================================= */

@media (max-width: 900px) {
	body {
		display: block;
		min-height: 100vh;
		height: auto;
		overflow-x: hidden;
	}

	/* Sidebar gaveta off-canvas */
	.sidebar {
		position: fixed;
		top: 0;
		left: -290px;
		width: 290px;
		height: 100vh;
		z-index: 1050;
		transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
		box-shadow: none;
		overflow-y: auto;
	}
	.sidebar.open {
		left: 0;
		box-shadow: 8px 0 35px rgba(0, 0, 0, 0.5);
	}
	.btn-sidebar-close {
		display: flex;
	}
	.btn-sidebar-toggle {
		display: flex;
	}

	/* Wrapper principal */
	.main-wrapper {
		width: 100%;
		min-height: 100vh;
		display: flex;
		flex-direction: column;
		overflow-y: visible;
	}

	/* Topbar */
	.topbar {
		padding: 10px 14px;
		position: sticky;
		top: 0;
		z-index: 99;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
	}
	.topbar h2 {
		font-size: 1.02rem;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 180px;
	}
	.badge-status-desktop {
		display: none !important;
	}
	.btn-logout {
		padding: 6px 10px;
		font-size: 0.8rem;
		border-radius: 6px;
	}

	/* Conteudo */
	.content {
		padding: 14px 10px;
	}

	/* Métricas */
	.metrics-grid, .metric-grid {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
		margin-bottom: 16px;
	}
	.metric-card {
		padding: 12px 10px;
		border-radius: 10px;
	}
	.metric-label {
		font-size: 0.72rem;
		margin-bottom: 4px;
	}
	.metric-val {
		font-size: 1.28rem;
	}
	.metric-sub {
		font-size: 0.74rem;
		margin-top: 4px;
	}

	/* Cards de Tabela */
	.data-card {
		border-radius: 12px;
		margin-bottom: 18px;
	}
	.data-card-header {
		padding: 12px 14px;
		flex-direction: column;
		align-items: flex-start;
		gap: 6px;
	}
	.data-card-header h3 {
		font-size: 1.05rem;
	}

	/* Tabelas com rolagem horizontal suave */
	.table-responsive {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		width: 100%;
		margin-bottom: 6px;
	}
	.custom-table th, .custom-table td {
		padding: 10px 8px;
		font-size: 0.82rem;
		white-space: nowrap;
	}

	/* Botões e Barras de Ação */
	.btn-action {
		min-height: 42px;
		padding: 8px 14px;
		font-size: 0.9rem;
		border-radius: 8px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
	}

	/* Cabeçalhos de Ação */
	div[style*="justify-content:space-between"] {
		flex-direction: column !important;
		align-items: stretch !important;
		gap: 12px !important;
	}
	div[style*="justify-content:space-between"] p {
		margin-bottom: 4px !important;
		font-size: 0.88rem !important;
	}
	div[style*="justify-content:space-between"] .btn-action {
		width: 100% !important;
	}

	/* Formulários e Modais */
	.form-grid {
		grid-template-columns: 1fr !important;
		gap: 12px !important;
	}
	.form-control {
		font-size: 16px !important;
		padding: 10px 12px !important;
		min-height: 42px !important;
		box-sizing: border-box;
	}
	.admin-modal-overlay {
		padding: 8px !important;
		align-items: center !important;
	}
	.admin-modal {
		max-width: 100% !important;
		width: 100% !important;
		max-height: 94vh !important;
		padding: 18px 14px !important;
		border-radius: 16px !important;
		margin: 0 !important;
		box-sizing: border-box;
	}
	.admin-modal h3 {
		font-size: 1.15rem;
	}
	.admin-modal div[style*="justify-content:flex-end"] {
		flex-direction: column-reverse !important;
		width: 100% !important;
		gap: 8px !important;
	}
	.admin-modal div[style*="justify-content:flex-end"] button {
		width: 100% !important;
		min-height: 44px !important;
	}

	/* Modal de Scanner Câmera */
	.scanner-modal {
		max-width: 100% !important;
		padding: 16px 12px !important;
	}
	.video-container {
		height: 220px !important;
	}
	.scanner-controls {
		flex-direction: column !important;
		gap: 8px !important;
	}
	.scanner-controls button {
		width: 100% !important;
		min-height: 44px !important;
	}

	/* Foto Preview no Cadastro de Produto */
	div[style*="position:relative; width:110px"] {
		width: 80px !important;
		height: 80px !important;
	}
	img#prod_foto_preview {
		width: 80px !important;
		height: 80px !important;
	}
}

@media (max-width: 480px) {
	.metrics-grid, .metric-grid {
		grid-template-columns: 1fr;
		gap: 8px;
	}
	.topbar h2 {
		max-width: 140px;
		font-size: 0.95rem;
	}
}




