/* ==========================================================================
   PHASU - tampilan area member (kalkulator, produk, riwayat, profil, auth)
   Mandiri: tidak butuh Bootstrap. Warna diatur lewat variabel di :root.
   ========================================================================== */
:root {
	--c-bg: #f4f6fb;
	--c-surface: #ffffff;
	--c-border: #e3e8f1;
	--c-text: #1f2937;
	--c-muted: #6b7280;
	--c-primary: #2563eb;
	--c-primary-soft: #e8efff;
	--c-success: #16a34a;
	--c-success-soft: #e7f7ed;
	--c-warning: #d97706;
	--c-warning-soft: #fdf3e2;
	--c-danger: #dc2626;
	--c-danger-soft: #fdeaea;
	--c-nav: #0f172a;
	--radius: 12px;
	--shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
	background: var(--c-bg);
	color: var(--c-text);
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
.text-muted { color: var(--c-muted) !important; }
.text-success { color: var(--c-success) !important; }
.text-danger { color: var(--c-danger) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ---------- navbar ---------- */
.mbr-nav {
	background: var(--c-nav);
	color: #fff;
	padding: 0 20px;
	position: sticky;
	top: 0;
	z-index: 50;
}
.mbr-nav-inner {
	max-width: 1200px;
	margin: 0 auto;
	min-height: 60px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}
.mbr-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; }
.mbr-brand:hover { text-decoration: none; }
.mbr-brand img { width: 32px; height: 32px; }
.mbr-brand small { display: block; font-weight: 400; font-size: 11px; color: #94a3b8; }
.mbr-menu { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mbr-menu a {
	color: #cbd5e1;
	padding: 7px 12px;
	border-radius: 8px;
	font-weight: 500;
	font-size: 13px;
}
.mbr-menu a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.mbr-menu a.active { background: rgba(37, 99, 235, .25); color: #fff; }
.mbr-menu a.btn-logout { color: #fca5a5; }
.mbr-menu .mbr-user { color: #94a3b8; font-size: 12px; padding: 0 6px; }

/* ---------- layout ---------- */
.mbr-container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; }
.mbr-container.narrow { max-width: 460px; }
.mbr-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.mbr-page-head h1 { font-size: 22px; margin: 0; }
.mbr-page-head p { margin: 4px 0 0; color: var(--c-muted); }
.mbr-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.mbr-grid.side { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
@media (max-width: 900px) {
	.mbr-grid, .mbr-grid.side { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- card ---------- */
.card {
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	margin-bottom: 20px;
}
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2, .card-head h3 { font-size: 15px; margin: 0; }
.card-body { padding: 18px; }

/* ---------- form ---------- */
.f-group { margin-bottom: 14px; }
.f-label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: #374151; }
.f-label .opt { font-weight: 400; color: var(--c-muted); }
.f-hint { display: block; font-size: 12px; color: var(--c-muted); margin-top: 4px; }
.f-row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.f-row.col-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 600px) {
	.f-row, .f-row.col-3 { grid-template-columns: minmax(0, 1fr); }
}
.inp, .inp-group {
	width: 100%;
	border: 1px solid #cfd6e4;
	border-radius: 9px;
	background: #fff;
	font-size: 14px;
	color: var(--c-text);
}
.inp { padding: 9px 12px; font-family: inherit; }
.inp:focus, .inp-group:focus-within { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
textarea.inp { resize: vertical; min-height: 70px; }
select.inp { appearance: auto; }
.inp-group { display: flex; align-items: stretch; overflow: hidden; }
.inp-group .addon { background: #f3f5fa; color: var(--c-muted); padding: 9px 11px; font-size: 13px; display: flex; align-items: center; white-space: nowrap; }
.inp-group input { flex: 1; min-width: 0; border: 0; padding: 9px 12px; font-size: 14px; font-family: inherit; background: transparent; color: var(--c-text); }
.inp-group input:focus { outline: none; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.chk input { width: 16px; height: 16px; }

/* ---------- tombol ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: 1px solid transparent;
	border-radius: 9px;
	padding: 9px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	line-height: 1.2;
	text-decoration: none !important;
	transition: background .15s, border-color .15s;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-outline { background: #fff; color: var(--c-text); border-color: #cfd6e4; }
.btn-outline:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- alert / badge ---------- */
.alert { border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; border: 1px solid transparent; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-heading { display: none; }
.alert-danger { background: var(--c-danger-soft); border-color: #f6c7c7; color: #991b1b; }
.alert-success { background: var(--c-success-soft); border-color: #bfe8cd; color: #166534; }
.alert-warning { background: var(--c-warning-soft); border-color: #f5dcb0; color: #92400e; }
.alert-info { background: var(--c-primary-soft); border-color: #c9d8fb; color: #1e40af; }
.tbl-badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.tbl-badge-success { background: var(--c-success-soft); color: var(--c-success); }
.tbl-badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }

/* ---------- kalkulator ---------- */
.formula-box { display: none; }
.formula-box.show { display: block; }
.formula-box code { display: block; background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; font-size: 12.5px; white-space: pre-wrap; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.preset-card {
	position: relative;
	border: 1.5px solid var(--c-border);
	border-radius: 10px;
	padding: 10px 12px;
	cursor: pointer;
	background: #fff;
	transition: border-color .15s, background .15s;
}
.preset-card:hover { border-color: #9db7f5; }
.preset-card.active { border-color: var(--c-primary); background: var(--c-primary-soft); }
.preset-card img { max-height: 22px; max-width: 70px; object-fit: contain; display: block; margin-bottom: 6px; }
.preset-card .p-name { font-weight: 700; font-size: 13px; }
.preset-card .p-sub { font-size: 11.5px; color: var(--c-muted); margin-top: 2px; }
.preset-card .p-check {
	position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
	background: var(--c-primary); color: #fff; font-size: 11px; display: none; align-items: center; justify-content: center;
}
.preset-card.active .p-check { display: flex; }
.target-row { display: flex; align-items: center; gap: 12px; }
.target-row input[type="range"] { flex: 1; accent-color: var(--c-primary); }
.target-input { width: 90px; }
.quick-targets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.btn-qt { border: 1px solid var(--c-border); background: #fff; border-radius: 99px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.btn-qt.active, .btn-qt:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-soft); }
.sentiment { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.sentiment.green { background: var(--c-success-soft); color: var(--c-success); }
.sentiment.yellow { background: var(--c-warning-soft); color: var(--c-warning); }
.sentiment.red { background: var(--c-danger-soft); color: var(--c-danger); }
.result-hero { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 20px 18px; }
.result-hero .label { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.result-hero .price { font-size: 32px; font-weight: 800; margin: 4px 0; }
.result-hero .bep { font-size: 13px; opacity: .9; }
.result-rows { padding: 6px 18px 12px; }
.result-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--c-border); }
.result-row:last-child { border-bottom: 0; }
.result-row .rv { font-weight: 600; white-space: nowrap; }
.result-row .rv.red { color: var(--c-danger); }
.result-row.total { font-weight: 700; }
.result-row.profit .rv { color: var(--c-success); font-size: 16px; }
.result-row.profit.minus .rv { color: var(--c-danger); }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix-table th, .matrix-table td { padding: 8px 10px; border-bottom: 1px solid var(--c-border); text-align: right; }
.matrix-table th:first-child, .matrix-table td:first-child { text-align: left; }
.matrix-table tr.active td { background: var(--c-primary-soft); font-weight: 700; }
.history-item { padding: 10px 0; border-bottom: 1px solid var(--c-border); display: flex; justify-content: space-between; gap: 10px; }
.history-item:last-child { border-bottom: 0; }
.history-item .h-name { font-weight: 600; }
.history-item .h-meta { font-size: 12px; color: var(--c-muted); }
.history-item .h-price { text-align: right; white-space: nowrap; }

/* ---------- tabel (DataTables tanpa bootstrap) ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100% !important; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--c-muted); background: #f8fafc; padding: 10px; border-bottom: 1px solid var(--c-border); white-space: nowrap; }
table.tbl td { padding: 10px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
table.tbl tbody tr:hover td { background: #fafbff; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { margin-bottom: 12px; }
.dataTables_wrapper .dataTables_filter { float: right; }
.dataTables_wrapper .dataTables_length { float: left; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select { border: 1px solid #cfd6e4; border-radius: 8px; padding: 6px 9px; margin-left: 6px; font-family: inherit; }
.dataTables_wrapper .dataTables_info { float: left; padding-top: 12px; color: var(--c-muted); font-size: 12.5px; }
.dataTables_wrapper .dataTables_paginate { float: right; padding-top: 10px; }
.dataTables_wrapper .dataTables_paginate .paginate_button { display: inline-block; padding: 5px 10px; margin-left: 3px; border: 1px solid var(--c-border); border-radius: 7px; cursor: pointer; font-size: 12.5px; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: .4; cursor: default; }
.dataTables_wrapper .dataTables_processing { padding: 8px; text-align: center; color: var(--c-muted); }
.dataTables_wrapper::after { content: ""; display: block; clear: both; }
.tbl-actions { display: flex; gap: 5px; }
.tbl-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 7px; font-size: 15px; text-decoration: none !important; }
.tbl-btn-edit { background: var(--c-primary-soft); color: var(--c-primary); }
.tbl-btn-kalkulator { background: var(--c-success-soft); color: var(--c-success); }
.tbl-btn-delete { background: var(--c-danger-soft); color: var(--c-danger); }

/* ---------- profil ---------- */
.info-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13.5px; }
.info-list dt { color: var(--c-muted); }
.info-list dd { margin: 0; font-weight: 500; word-break: break-word; }
.quota { margin-bottom: 14px; }
.quota-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.quota-bar { height: 8px; background: #edf1f7; border-radius: 99px; overflow: hidden; }
.quota-bar span { display: block; height: 100%; background: var(--c-primary); border-radius: 99px; }
.quota-bar span.warn { background: var(--c-warning); }
.quota-bar span.full { background: var(--c-danger); }
.api-key { display: flex; gap: 8px; align-items: center; }
.api-key code { flex: 1; background: #f3f5fa; border: 1px solid var(--c-border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- auth ---------- */
.auth-card { margin-top: 30px; }
.auth-card .card-body { padding: 26px; }
.auth-card h1 { font-size: 22px; }
.auth-foot { text-align: center; margin-top: 14px; color: var(--c-muted); }

/* ---------- toast ---------- */
#mbr-toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: none; max-width: 360px; }
#mbr-toast .toast-inner { padding: 12px 16px; border-radius: 10px; color: #fff; box-shadow: var(--shadow); font-weight: 500; }
#mbr-toast .toast-inner.success { background: var(--c-success); }
#mbr-toast .toast-inner.danger { background: var(--c-danger); }
#mbr-toast .toast-inner.info { background: var(--c-primary); }

.mbr-footer { text-align: center; color: var(--c-muted); font-size: 12px; padding: 20px; }
