:root {
	--text: #2c2c2b;
	--text-muted: #7d7a75;
	--canvas: #ffffff;
	--surface: #f9f8f7;
	--surface-2: #f0efed;
	--border: #e6e5e3;
	--blue: #2783de;
	--blue-soft: #e5f2fc;
	--green: #46a171;
	--green-soft: #e8f1ec;
	--orange: #d5803b;
	--orange-soft: #fbebde;
	--red: #e56458;
	--red-soft: #fce9e7;
	--radius: 8px;
	--radius-lg: 12px;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.5;
	color: var(--text);
	background: var(--surface);
	-webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */

.app-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--canvas);
	border-bottom: 1px solid var(--border);
}

.app-header__bar {
	max-width: 1000px;
	margin: 0 auto;
	padding: 12px 24px;
	display: flex;
	align-items: center;
	gap: 16px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 650;
	letter-spacing: -0.01em;
}

.brand__mark {
	width: 28px;
	height: 28px;
	border-radius: var(--radius);
	background: var(--blue);
	color: #fff;
	display: grid;
	place-items: center;
	font-size: 15px;
	font-weight: 700;
}

.sync-pill {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 14px;
	background: var(--green-soft);
	color: #2f6f4e;
	border: 1px solid transparent;
	cursor: pointer;
}

.sync-pill[data-state="pending"] { background: var(--orange-soft); color: #8a4f16; }
.sync-pill[data-state="offline"] { background: var(--surface-2); color: var(--text-muted); }
.sync-pill[data-state="error"] { background: var(--red-soft); color: #a4392e; }

.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Navigasi ---------- */

.nav {
	max-width: 1000px;
	margin: 0 auto;
	padding: 0 16px;
	display: flex;
	gap: 4px;
	overflow-x: auto;
}

.nav a {
	padding: 10px 14px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	font-size: 15px;
	text-decoration: none;
	color: var(--text-muted);
	border-bottom: 2px solid transparent;
	white-space: nowrap;
}

.nav a:hover { color: var(--text); }
.nav a.is-active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 550; }

/* ---------- Tata letak ---------- */

main {
	max-width: 1000px;
	margin: 0 auto;
	padding: 32px 24px 96px;
}

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.02em; }
.page-head p { margin: 0; color: var(--text-muted); font-size: 15px; }

.section { margin-top: 32px; }
.section > h2 { font-size: 18px; margin: 0 0 12px; }

.card {
	background: var(--canvas);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 20px;
}

.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- Kartu pertemuan ---------- */

.slot {
	display: flex;
	align-items: center;
	gap: 16px;
	width: 100%;
	text-align: left;
	background: var(--canvas);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 16px;
	min-height: 44px;
	cursor: pointer;
	font: inherit;
	color: inherit;
	transition: border-color 0.15s ease;
}

.slot:hover { border-color: #d5d3d0; }
.slot:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.slot__jp {
	flex: none;
	width: 56px;
	height: 56px;
	border-radius: var(--radius);
	background: var(--surface-2);
	display: grid;
	place-items: center;
	line-height: 1.1;
	text-align: center;
}

.slot__jp b { font-size: 16px; display: block; }
.slot__jp span { font-size: 11px; color: var(--text-muted); }

.slot__main { min-width: 0; flex: 1; }
.slot__title { display: block; font-weight: 600; }
.slot__sub {
	display: block;
	font-size: 14px;
	color: var(--text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.slot--done .slot__jp { background: var(--green-soft); }

/* ---------- Badge ---------- */

.badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 550;
	background: var(--surface-2);
	color: var(--text-muted);
	white-space: nowrap;
}

.badge--done { background: var(--green-soft); color: #2f6f4e; }
.badge--todo { background: var(--orange-soft); color: #8a4f16; }
.badge--kosong { background: var(--red-soft); color: #a4392e; }
.badge--tugas { background: var(--blue-soft); color: #1c5fa3; }

/* ---------- Statistik ---------- */

.stat {
	background: var(--canvas);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 16px;
}

.stat__label { font-size: 13px; color: var(--text-muted); }
.stat__value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.stat__hint { font-size: 13px; color: var(--text-muted); }

.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--blue); }

/* ---------- Formulir ---------- */

.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 14px; font-weight: 550; margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

input[type="text"], input[type="number"], input[type="date"], input[type="password"],
input[type="url"], select, textarea {
	width: 100%;
	padding: 10px 12px;
	min-height: 44px;
	font: inherit;
	color: inherit;
	background: var(--canvas);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

textarea { min-height: 80px; resize: vertical; }

input:focus, select:focus, textarea:focus {
	outline: 2px solid var(--blue);
	outline-offset: 1px;
	border-color: var(--blue);
}

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }

/* ---------- Tombol ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 16px;
	font: inherit;
	font-weight: 550;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	background: var(--canvas);
	color: var(--text);
	cursor: pointer;
}

.btn:hover { background: var(--surface); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--primary:hover { background: #2176c8; }
.btn--danger { color: var(--red); border-color: #f0cdc9; background: var(--red-soft); }
.btn--sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
	padding: 8px 14px;
	min-height: 40px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--canvas);
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}

.chip[aria-pressed="true"] {
	background: var(--blue-soft);
	border-color: #a9d3f4;
	color: #1c5fa3;
	font-weight: 550;
}

/* ---------- Tabel ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--canvas); }

table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Dialog ---------- */

dialog {
	border: 0;
	border-radius: var(--radius-lg);
	padding: 0;
	width: min(640px, calc(100vw - 32px));
	box-shadow: var(--shadow);
	color: var(--text);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.dialog__head { padding: 20px 24px 0; }
.dialog__head h2 { margin: 0 0 2px; font-size: 20px; }
.dialog__head p { margin: 0; color: var(--text-muted); font-size: 14px; }
.dialog__body { padding: 20px 24px; max-height: 65vh; overflow-y: auto; }
.dialog__foot {
	padding: 16px 24px;
	border-top: 1px solid var(--border);
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	flex-wrap: wrap;
	background: var(--surface);
	border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Lain-lain ---------- */

.empty {
	text-align: center;
	padding: 40px 24px;
	color: var(--text-muted);
	background: var(--canvas);
	border: 1px dashed var(--border);
	border-radius: var(--radius-lg);
}

.toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translateX(-50%);
	background: var(--text);
	color: #fff;
	padding: 10px 18px;
	border-radius: 999px;
	font-size: 14px;
	z-index: 60;
	box-shadow: var(--shadow);
}

.list { display: grid; gap: 8px; }

.list-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: var(--canvas);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.list-item__main { flex: 1; min-width: 0; }
.list-item__sub { display: block; font-size: 14px; color: var(--text-muted); }

.muted { color: var(--text-muted); }
.small { font-size: 14px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

@media (max-width: 640px) {
	.app-header__bar, .nav { padding-left: 16px; padding-right: 16px; }
	main { padding: 24px 16px 96px; }
	.page-head h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}

@media print {
	.app-header, .nav, .btn, .toast { display: none !important; }
	body { background: #fff; }
	main { max-width: none; padding: 0; }
}
