:root {
	--sidebar-bg: #16213e;
	--sidebar-hover: #1a2a52;
	--accent: #c9a84c;
	--content-bg: #f4f6f9;
}

*, *::before, *::after {
	box-sizing: border-box;
}

html, body {
	height: 100%;
	margin: 0;
	background: var(--content-bg);
	font-family: 'Segoe UI', system-ui, sans-serif;
}

.crm-wrapper {
	display: flex;
	min-height: 100vh;
}

/* SIDEBAR */
.crm-sidebar {
	width: 240px;
	min-height: 100vh;
	background: var(--sidebar-bg);
	position: fixed;
	top: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	z-index: 100;
}

.crm-logo {
	padding: 1.5rem 1.25rem 1.1rem;
	border-bottom: 1px solid rgba(255,255,255,0.07);
}

.crm-logo .logo-title {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--accent);
	letter-spacing: 0.02em;
}

.crm-logo .logo-sub {
	font-size: 0.65rem;
	color: rgba(255,255,255,0.35);
	text-transform: uppercase;
	letter-spacing: 0.12em;
}

.crm-nav {
	padding: 0.75rem 0;
	flex: 1;
	overflow-y: auto;
}

.crm-nav a i,
.crm-nav a svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.kpi-icon i,
.kpi-icon svg {
	width: 22px;
	height: 22px;
}


.crm-nav a {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 1.25rem;
	color: rgba(255,255,255,0.88);
	font-size: 0.875rem;
	text-decoration: none;
	border-left: 3px solid transparent;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.crm-nav a:hover {
	background: var(--sidebar-hover);
	color: #fff;
	border-left-color: rgba(201,168,76,0.4);
}

.crm-nav a.active {
	background: rgba(201,168,76,0.1);
	color: var(--accent);
	border-left-color: var(--accent);
	font-weight: 600;
}

/* MAIN */
.crm-main {
	margin-left: 240px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

/* TOPBAR */
.crm-topbar {
	height: 58px;
	background: #fff;
	border-bottom: 1px solid #eaeaea;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 1.75rem;
	position: sticky;
	top: 0;
	z-index: 50;
	box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.topbar-title {
	font-size: 1rem;
	font-weight: 600;
	color: #222;
}

.topbar-right {
	display: flex;
	align-items: center;
	gap: 1.1rem;
}


.topbar-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--accent);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* CONTENT */
.crm-content {
	padding: 1.75rem 2rem;
	flex: 1;
}

/* KPI CARDS */
.kpi-card {
	background: #fff;
	border-radius: 10px;
	padding: 1.2rem 1.4rem;
	display: flex;
	align-items: center;
	gap: 1rem;
	box-shadow: 0 2px 8px rgba(0,0,0,0.055);
	border-left: 4px solid transparent;
}

.kpi-card.gold {
	border-left-color: #c9a84c;
}

.kpi-card.blue {
	border-left-color: #3273dc;
}

.kpi-card.green {
	border-left-color: #48c774;
}

.kpi-card.red {
	border-left-color: #f14668;
}

.kpi-icon {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.15rem;
	flex-shrink: 0;
}

.kpi-card.gold .kpi-icon {
	background: #fdf3d7;
	color: #c9a84c;
}

.kpi-card.blue .kpi-icon {
	background: #e8f0fe;
	color: #3273dc;
}

.kpi-card.green .kpi-icon {
	background: #e6f8ec;
	color: #257942;
}

.kpi-card.red .kpi-icon {
	background: #fde8ec;
	color: #cc0f35;
}

.kpi-value {
	font-size: 1.55rem;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1;
}

.kpi-label {
	font-size: 0.75rem;
	color: #999;
	margin-top: 0.2rem;
}

/* TABLE CARD */
.table-card {
	background: #fff;
	border-radius: 10px;
	padding: 1.25rem 1.5rem;
	box-shadow: 0 2px 8px rgba(0,0,0,0.055);
}

.table-card-title {
	font-size: 0.92rem;
	font-weight: 600;
	color: #222;
	margin-bottom: 1rem;
}

/* DATATABLES TWEAKS */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
	border: 1px solid #dbdbdb;
	border-radius: 6px;
	padding: 0.35rem 0.65rem;
	font-size: 0.83rem;
	outline: none;
}

.dataTables_wrapper .dataTables_filter input:focus {
	border-color: var(--accent);
}

table.dataTable thead th {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #aaa !important;
	border-bottom: 2px solid #f0f0f0 !important;
}

table.dataTable tbody tr:hover td {
	background: #fafbff;
}

/* STATO BADGES */
.stato {
	display: inline-block;
	padding: 0.18em 0.65em;
	border-radius: 20px;
	font-size: 0.75rem;
	font-weight: 600;
}

.stato-pagata {
	background: #e6f8ec;
	color: #257942;
}

.stato-attesa {
	background: #fdf3d7;
	color: #946c00;
}

.stato-scaduta {
	background: #fde8ec;
	color: #cc0f35;
}

.login-wrapper {
	min-height: 100vh;
	display: flex;
}

/* pannello sinistro decorativo */
.login-brand {
	width: 420px;
	background: var(--sidebar-bg);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	padding: 3rem;
	flex-shrink: 0;
}

.login-brand .brand-name {
	font-size: 1.6rem;
	font-weight: 700;
	color: var(--accent);
	letter-spacing: 0.02em;
	margin-bottom: 0.4rem;
}

.login-brand .brand-sub {
	font-size: 0.75rem;
	color: rgba(255,255,255,0.4);
	text-transform: uppercase;
	letter-spacing: 0.15em;
	margin-bottom: 2.5rem;
}


.brand-divider {
	width: 40px;
	height: 2px;
	background: var(--accent);
	margin: 1.5rem auto;
	opacity: 0.6;
}

/* pannello destro con form */
.login-form-panel {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
}

.login-box {
	width: 100%;
	max-width: 380px;
}

.login-box h2 {
	font-size: 1.4rem;
	font-weight: 700;
	color: #1a1a1a;
	margin-bottom: 0.4rem;
}

.login-box .login-subtitle {
	font-size: 0.85rem;
	color: #aaa;
	margin-bottom: 2rem;
}

.field label.label {
	font-size: 0.8rem;
	font-weight: 600;
	color: #555;
	margin-bottom: 0.3rem;
}

.input {
	border-radius: 8px;
	border-color: #e0e0e0;
	font-size: 0.9rem;
	height: 2.6rem;
	box-shadow: none !important;
	transition: border-color 0.15s;
}

.input:focus {
	border-color: var(--accent) !important;
}

.btn-login {
	width: 100%;
	height: 2.7rem;
	background: var(--accent);
	color: #fff;
	font-weight: 700;
	font-size: 0.92rem;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	letter-spacing: 0.03em;
	transition: background 0.15s, transform 0.1s;
}

.btn-login:hover {
	background: #b8922e;
}

.btn-login:active {
	transform: scale(0.99);
}

.login-footer {
	text-align: center;
	margin-top: 1.5rem;
	font-size: 0.78rem;
	color: #ccc;
}

@media (max-width: 768px) {
	.login-brand {
		display: none;
	}
}
