:root {
  --purple: #6d28d9;
  --purple-2: #8b5cf6;
  --purple-3: #4c1d95;
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e9eaf3;
  --green: #0f9d58;
  --green-bg: #e6f6ee;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(31, 41, 55, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Baloo Bhaijaan 2", "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--purple); text-decoration: none; }
button { font-family: inherit; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; }

.topbar {
  background: linear-gradient(135deg, var(--purple-2), var(--purple) 60%, var(--purple-3));
  color: #fff;
  padding: 18px 18px 26px;
  border-radius: 0 0 26px 26px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; }
.topbar .sub { font-size: 12.5px; opacity: .85; margin-top: 2px; }
.topbar .logo {
  width: 46px; height: 46px; border-radius: 14px; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: 22px; margin-inline-start: auto;
}
.topbar .spacer { margin-inline-start: auto; }

.btn {
  border: 0; border-radius: 14px; padding: 13px 18px; font-size: 15.5px; font-weight: 700;
  background: var(--purple); color: #fff; cursor: pointer; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--purple); border: 1.5px solid var(--purple); }
.btn.soft { background: #f0ebff; color: var(--purple-3); }
.btn.small { width: auto; padding: 8px 14px; font-size: 13.5px; border-radius: 11px; }
.btn.danger { background: var(--red-bg); color: var(--red); }
.btn:disabled { opacity: .6; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card h2 { font-size: 16px; margin: 0 0 12px; }

.hero { text-align: center; padding: 34px 18px 8px; }
.hero .mark {
  width: 86px; height: 86px; border-radius: 24px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--purple-2), var(--purple-3));
  display: grid; place-items: center; color: #fff; font-size: 40px;
  box-shadow: 0 10px 26px rgba(109, 40, 217, .3);
}
.hero h1 { font-size: 23px; margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0 0 22px; font-size: 14.5px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { border-radius: var(--radius); padding: 14px 10px; text-align: center; color: #fff; box-shadow: var(--shadow); }
.stat .n { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: 12.5px; opacity: .95; margin-top: 2px; }
.stat.p1 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.stat.p2 { background: linear-gradient(135deg, #10b981, #059669); }
.stat.p3 { background: linear-gradient(135deg, #f59e0b, #d97706); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  background: #fff; border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; cursor: pointer; border: 0; text-align: start; width: 100%;
}
.tile .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; }
.tile .t { font-weight: 700; font-size: 14.5px; }
.tile .s { font-size: 12px; color: var(--muted); }

.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 700; font-size: 15px; }
.row .meta { font-size: 12.5px; color: var(--muted); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #f0ebff; color: var(--purple); font-weight: 800; flex: 0 0 auto;
}

.pill { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.mut { background: #eef0f6; color: var(--muted); }

.section-title { font-size: 15px; font-weight: 800; margin: 18px 4px 10px; display: flex; align-items: center; }
.section-title a { margin-inline-start: auto; font-size: 12.5px; font-weight: 700; }

label { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 6px; color: #374151; }
input, select, textarea {
  width: 100%; padding: 12px 13px; border-radius: 13px; border: 1.5px solid var(--line);
  background: #fbfbfe; font-family: inherit; font-size: 15px; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple-2); background: #fff; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.error { color: var(--red); font-size: 13.5px; font-weight: 700; min-height: 20px; margin-top: 10px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20;
}
.tabbar button {
  flex: 1; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 700;
  padding: 6px 0; display: grid; gap: 2px; justify-items: center; cursor: pointer;
}
.tabbar button .i { font-size: 18px; line-height: 1; }
.tabbar button.active { color: var(--purple); }

.sheet-bg {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 40;
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-bg.open { display: flex; }
.sheet {
  background: #fff; width: 100%; max-width: 720px; border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow: auto;
}
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet .close { float: left; border: 0; background: #f0ebff; color: var(--purple); border-radius: 10px; padding: 6px 12px; font-weight: 700; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); bottom: 84px;
  background: #111827; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13.5px;
  opacity: 0; transition: all .2s; z-index: 60; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hide { display: none !important; }
.mt { margin-top: 14px; }
.gap { height: 10px; }

.tile .ic svg, .tabbar .i svg { width: 20px; height: 20px; display: block; }
.tile .ic svg { width: 21px; height: 21px; }
.topbar .logo svg, .hero .mark svg { display: block; }
