:root {
	--brand: #2563eb;
	--brand-dark: #1e3a8a;
	--brand-navy: #0a2540;
	--sidebar-bg: #0b1f3a;
	--sidebar-bg-2: #12305c;
	--sidebar-w: 250px;
	--border: #e4e9f0;
	--bg-body: #f2f5fa;
	--text-muted: #5b6b83;
	--shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
	--shadow-md: 0 6px 18px rgba(16, 24, 40, .07);
}

* { box-sizing: border-box; }

body.app-body {
	background: var(--bg-body);
	font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
	margin: 0;
}

/* ---------- Layout ---------- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
	width: var(--sidebar-w);
	background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
	color: #c9d8f0;
	display: flex;
	flex-direction: column;
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	z-index: 1040;
	transition: transform .2s ease;
	border-right: 1px solid rgba(255, 255, 255, .06);
}

.sidebar-brand {
	padding: 22px 20px 12px;
	font-size: 1.3rem;
	font-weight: 800;
	color: #fff;
	letter-spacing: .3px;
}
.sidebar-brand i {
	color: var(--brand);
	margin-right: 6px;
	background: rgba(37, 99, 235, .18);
	border-radius: 10px;
	padding: 4px 6px;
	width: 30px;
	text-align: center;
}
.sidebar-logo {
	width: 30px; height: 30px;
	border-radius: 8px;
	object-fit: cover;
	margin-right: 7px;
	vertical-align: -6px;
}
.sidebar-brand span { color: #60a5fa; }

.sidebar-label {
	padding: 4px 22px 10px;
	font-size: .72rem;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: #6f8ab5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sidebar-nav { flex: 1; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-nav a {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 14px;
	border-radius: 10px;
	color: #c9d8f0;
	text-decoration: none;
	font-size: .93rem;
	font-weight: 500;
	transition: background .15s, color .15s;
}
.sidebar-nav a i { width: 20px; text-align: center; color: #7d9bc9; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-nav a:hover i { color: #93c5fd; }
.sidebar-nav a.active {
	background: linear-gradient(90deg, rgba(37, 99, 235, .35), rgba(37, 99, 235, .12));
	color: #fff;
	border-left: 3px solid var(--brand);
	border-radius: 8px;
}
.sidebar-nav a.active i { color: #93c5fd; }

.sidebar-group .sidebar-group-caret { margin-left: auto; font-size: .7rem; transition: transform .15s; }
.sidebar-group a[aria-expanded="true"] .sidebar-group-caret { transform: rotate(180deg); }
.sidebar-group .collapse { padding-left: 8px; }
.sidebar-subnav {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 14px;
	border-radius: 8px;
	color: #a9c1e6;
	text-decoration: none;
	font-size: .87rem;
	transition: background .15s;
}
.sidebar-subnav i { width: 20px; text-align: center; color: #6f8ab5; }
.sidebar-subnav:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-subnav:hover i { color: #93c5fd; }
.sidebar-subnav.active {
	background: rgba(37, 99, 235, .28);
	color: #fff;
	border-left: 3px solid var(--brand);
}
.sidebar-subnav.active i { color: #93c5fd; }

.wallet-option {
	display: block;
	cursor: pointer;
}

.wallet-option .border {
	border-color: var(--bs-border-color) !important;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.wallet-option:hover .border {
	border-color: var(--bs-primary) !important;
}

.wallet-option.wallet-selected .border {
	border-color: var(--ws-primary, #0d6efd) !important;
	border-width: 2px;
	box-shadow: 0 0 0 3px rgba(13, 110, 253, .15);
}
.sidebar-plan {
	margin: 10px 14px;
	padding: 10px 12px;
	border-radius: 10px;
	background: rgba(255, 255, 255, .06);
	font-size: .78rem;
	color: #a9c1e6;
}
.sidebar-plan .progress { background-color: rgba(255, 255, 255, .12); }

.sidebar-footer { padding: 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-user { display: flex; gap: 10px; align-items: center; color: #e8f0fc; }
.sidebar-user i { font-size: 1.2rem; color: #60a5fa; }
.sidebar-user small { display: block; color: #7d9bc9; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
	background: #fff;
	padding: 14px 24px;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: 14px;
	position: sticky;
	top: 0;
	z-index: 1020;
	box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--brand-navy); }

.content { padding: 24px; flex: 1; }

@media (max-width: 991.98px) {
	.sidebar { transform: translateX(-100%); }
	.sidebar.show { transform: translateX(0); }
	.main { margin-left: 0; }
}

/* ---------- Panels & cards ---------- */
.panel {
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 20px;
	margin-bottom: 20px;
	box-shadow: var(--shadow-sm);
	transition: box-shadow .2s;
}
.panel:hover { box-shadow: var(--shadow-md); }
.panel-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
	gap: 10px;
	flex-wrap: wrap;
}
.panel-title h5 { margin: 0; font-weight: 700; font-size: 1rem; color: var(--brand-navy); }
.panel-title h5 i {
	color: var(--brand);
	margin-right: 8px;
	background: rgba(37, 99, 235, .1);
	padding: 5px 7px;
	border-radius: 8px;
}

.stat-card {
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 18px;
	display: flex;
	gap: 14px;
	align-items: center;
	box-shadow: var(--shadow-sm);
	height: 100%;
	transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
	width: 52px;
	height: 52px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.3rem;
	flex-shrink: 0;
}
.stat-value { font-size: 1.45rem; font-weight: 800; line-height: 1.1; color: var(--brand-navy); }
.stat-label { font-size: .85rem; color: var(--text-muted); font-weight: 600; }

.instance-card { border: 1px solid var(--border); border-radius: 12px; box-shadow: none; }
.instance-card:hover { box-shadow: var(--shadow-md); }

/* ---------- Login ---------- */
.login-body {
	background:
		radial-gradient(900px 500px at 15% -10%, rgba(37, 99, 235, .45), transparent 60%),
		radial-gradient(800px 500px at 110% 110%, rgba(96, 165, 250, .35), transparent 60%),
		linear-gradient(135deg, #081a33 0%, #0b1f3a 45%, #12305c 100%);
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card { border: 1px solid rgba(255, 255, 255, .5); border-radius: 18px; }
.login-logo {
	width: 64px; height: 64px;
	margin: 0 auto 12px;
	background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
	color: #fff;
	border-radius: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.9rem;
	box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
	object-fit: cover;
	padding: 4px;
}
/* ---------- Alerts ---------- */
.app-alert { border: none; border-radius: 10px; font-size: .92rem; }

/* ---------- Inbox ---------- */
.inbox-app {
	display: flex;
	height: calc(100vh - 130px);
	min-height: 480px;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 14px;
	overflow: hidden;
}
.inbox-side { width: 320px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.inbox-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.inbox-list { flex: 1; overflow-y: auto; }
.inbox-item { padding: 12px 14px; border-bottom: 1px solid #f0f1f3; cursor: pointer; }
.inbox-item:hover { background: #f6f8fc; }
.inbox-item.active { background: #e8f0fe; border-left: 3px solid var(--brand); }
.inbox-messages {
	overflow-y: auto;
	padding: 16px;
	background: #eef2f8;
	background-image: radial-gradient(rgba(11, 31, 58, .05) 1px, transparent 1px);
	background-size: 16px 16px;
}
.chat-bubble {
	max-width: 65%;
	margin-bottom: 10px;
	padding: 8px 12px;
	border-radius: 10px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
	position: relative;
}
.chat-in { background: #fff; align-self: flex-start; margin-right: auto; }
.chat-out { background: #dbeafe; margin-left: auto; align-self: flex-end; }
.chat-bot { border: 1px solid #93c5fd; }
.chat-text { white-space: pre-wrap; word-wrap: break-word; font-size: .92rem; }
.chat-time { font-size: .68rem; display: block; text-align: right; margin-top: 2px; }

.table-responsive { margin: -6px; }
.table { margin-bottom: 0; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); border-bottom-width: 1px; }
/* ---------- WhatsApp API docs / tables ---------- */
.panel-footer { border-top: 1px solid var(--border); padding: 12px 20px; }
.section-title { font-size: .9rem; font-weight: 700; margin-top: 18px; }
.code-block {
	background: linear-gradient(180deg, #081a33, #0b2244);
	color: #bfdbfe;
	border: 1px solid rgba(37, 99, 235, .3);
	border-radius: 10px;
	padding: 14px 16px;
	font-size: .8rem;
	overflow-x: auto;
	white-space: pre-wrap;
	word-break: break-word;
}
.app-table { font-size: .85rem; }
.app-table thead th { color: var(--text-muted); font-weight: 600; border-bottom-width: 1px; }
.app-tabs .nav-link { font-size: .85rem; color: #475467; }
.app-tabs .nav-link.active { font-weight: 600; color: var(--brand-dark); }
.form-label + .input-group .font-monospace { letter-spacing: .5px; }

/* ---------- Tombol & badge tambahan ---------- */
.btn { border-radius: 8px; }
.btn-primary,
.btn-success {
	background: var(--brand-dark);
	border-color: var(--brand-dark);
	color: #fff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-success:hover, .btn-success:focus, .btn-success:active {
	background: #172554;
	border-color: #172554;
	color: #fff;
}
.btn-outline-primary,
.btn-outline-success {
	color: var(--brand-dark);
	border-color: var(--brand-dark);
}
.btn-outline-primary:hover, .btn-outline-primary:focus,
.btn-outline-success:hover, .btn-outline-success:focus {
	background: var(--brand-dark);
	border-color: var(--brand-dark);
	color: #fff;
}
.badge { font-weight: 600; }

/* ---------- Pre di panel (email tutorial/detail) ---------- */
pre { border-radius: 8px; border: 1px solid var(--border); }

/* ---------- Scrollbar halus ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3cfdf; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #a6b7cd; }
