@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --navy: #1F2A44; --gold: #C9A227; --ink: #2B2F36; --grey: #6B7280; --line: #DDE1E8;
  --tint: #F3F5F9; --bg: #FAFBFC; --white: #fff;
  --c-intimacy: #A8505A; --t-intimacy: #F7ECED;
  --c-responsibility: #2F6F6A; --t-responsibility: #E8F2F1;
  --c-integrity: #8A6A1E; --t-integrity: #F8F2E2;
  --c-communication: #34508A; --t-communication: #EAEFF8;
  --s1: #A8505A; --s2: #C98A3A; --s3: #4E8A6E; --s4: #2F5E8A;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Poppins", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--c-communication); }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* layout */
.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(84px + var(--safe-b)); }
.topbar { background: var(--navy); color: #fff; padding: calc(14px + env(safe-area-inset-top, 0px)) 20px 18px; position: relative; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--gold); }
.topbar .kicker { color: var(--gold); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.topbar h1 { margin: 2px 0 0; font-size: 23px; line-height: 1.25; font-weight: 700; }
.topbar .back { background: none; border: 0; color: #C9CFDB; padding: 0; margin-bottom: 6px; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.topbar .right { position: absolute; right: 16px; top: calc(14px + env(safe-area-inset-top, 0px)); }
.iconbtn { background: rgba(255,255,255,.1); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.content { padding: 18px 18px 24px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }
.muted { color: var(--grey); }
.small { font-size: 13px; }
p { margin: 0 0 10px; }

/* nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 20; }
.nav-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.nav a { text-decoration: none; color: var(--grey); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 10px; font-size: 11px; font-weight: 500; }
.nav a svg { width: 23px; height: 23px; }
.nav a.on { color: var(--navy); }
.nav a.on svg { color: var(--gold); }

/* cards and buttons */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.tint { background: var(--tint); border-color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 700; font-size: 15px; background: var(--navy); color: #fff; text-decoration: none; }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line); }
.btn.danger { background: transparent; color: #A8505A; border: 1.5px solid #E7C9CC; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* forms */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; font-size: 16px; outline: none; }
input:focus, textarea:focus { border-color: var(--navy); }
textarea { resize: vertical; min-height: 96px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 6px; font-weight: 500; font-size: 14px; }
.seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.err { color: #A8505A; font-size: 13px; margin: -4px 0 12px; }

/* auth */
.auth { min-height: 100vh; background: var(--navy); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 32px 22px calc(32px + var(--safe-b)); }
.auth-inner { max-width: 420px; width: 100%; margin: 0 auto; }
.auth .logo { width: 84px; height: 84px; border-radius: 20px; display: block; margin: 0 auto 18px; }
.auth h1 { text-align: center; margin: 0; font-size: 28px; }
.auth .tagline { text-align: center; color: #C9CFDB; margin: 6px 0 26px; }
.auth .panel { background: #fff; color: var(--ink); border-radius: 18px; padding: 22px 18px; }
.auth .switch { text-align: center; margin-top: 16px; color: #C9CFDB; font-size: 14px; }
.auth .switch button { background: none; border: 0; color: var(--gold); font-weight: 700; padding: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--c-communication); font-weight: 500; font-size: 13px; }

/* four corner boxes */
.corners { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.corner-box { border: 0; border-radius: 16px; padding: 14px 10px 14px; text-align: center; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; min-height: 168px; }
.corner-box::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--cc); }
.corner-box .cname { font-weight: 700; font-size: 16px; color: var(--cc); margin-top: 4px; }
.corner-box .num { margin-top: 12px; width: 92px; height: 92px; background: #fff; border: 2px solid var(--cc); border-radius: 14px; display: grid; place-items: center; font-size: 44px; font-weight: 700; color: var(--ink); }
.corner-box .num.empty { color: #C3C8D1; font-size: 15px; font-weight: 500; }
.corner-box.low { box-shadow: 0 0 0 3px var(--gold) inset; }
.corner-box .lowtag[hidden] { display: inline-block; visibility: hidden; }
.corner-box .lowtag { display: inline-block; margin-top: 10px; background: var(--gold); color: var(--navy); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }
.k-intimacy { --cc: var(--c-intimacy); background: var(--t-intimacy); }
.k-responsibility { --cc: var(--c-responsibility); background: var(--t-responsibility); }
.k-integrity { --cc: var(--c-integrity); background: var(--t-integrity); }
.k-communication { --cc: var(--c-communication); background: var(--t-communication); }

/* number sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(15, 20, 35, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 18px 18px calc(22px + var(--safe-b)); animation: up .2s ease-out; }
.sheet h3 { margin: 0; font-size: 20px; color: var(--cc); }
.sheet .def { color: var(--grey); font-size: 14px; margin: 4px 0 12px; }
.sheet ul { margin: 0 0 14px; padding-left: 18px; font-size: 13px; color: var(--ink); }
.sheet ul li { margin-bottom: 3px; }
.numgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.numgrid button { border: 0; border-radius: 12px; height: 52px; font-size: 20px; font-weight: 700; color: #fff; }
.numgrid button.sel { outline: 3px solid var(--navy); outline-offset: 2px; }
.b1 { background: var(--s1); } .b2 { background: var(--s2); } .b3 { background: var(--s3); } .b4 { background: var(--s4); }
.scale-key { display: flex; justify-content: space-between; font-size: 11px; color: var(--grey); margin-top: 8px; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

/* person cards */
.person { display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.person .top { display: flex; align-items: center; gap: 10px; }
.person .pname { font-weight: 700; font-size: 16px; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 500; background: var(--tint); color: var(--grey); padding: 2px 8px; border-radius: 20px; }
.mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.mini div { border-radius: 9px; padding: 5px 0 4px; text-align: center; }
.mini b { display: block; font-size: 17px; line-height: 1.2; color: var(--ink); }
.mini span { display: block; font-size: 10px; font-weight: 500; color: var(--cc); }
.mini div.low { box-shadow: 0 0 0 2px var(--gold) inset; }
.avg { font-weight: 700; color: var(--navy); font-size: 15px; }
.unrated { font-size: 13px; color: var(--grey); margin-top: 8px; }

/* progress */
.progress { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; }
.progress > div { height: 100%; background: var(--gold); border-radius: 8px; }

/* bars */
.bar { display: grid; grid-template-columns: 112px 1fr 34px; gap: 10px; align-items: center; margin: 7px 0; font-size: 13px; font-weight: 500; }
.bar .track { height: 12px; background: var(--tint); border-radius: 8px; overflow: hidden; }
.bar .track div { height: 100%; background: var(--cc); border-radius: 8px; }
.bar b { text-align: right; }

/* table */
.gtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.gtable th { font-size: 10.5px; font-weight: 700; color: var(--grey); text-transform: uppercase; letter-spacing: .03em; padding: 6px 4px; text-align: center; }
.gtable th:first-child, .gtable td:first-child { text-align: left; }
.gtable td { padding: 9px 4px; border-top: 1px solid var(--line); text-align: center; }
.gtable td.lo { color: #A8505A; font-weight: 700; }
.gtable td.na { color: #C3C8D1; }
.gtable .cnt { color: var(--grey); font-size: 11px; }

/* insight */
.insight { display: flex; gap: 12px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.insight .dot { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--gold); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.insight p { margin: 0; }

/* focus action */
.focus { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px; position: relative; overflow: hidden; }
.focus::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--cc); }
.focus .meta { font-size: 12px; color: #C9CFDB; }
.focus .meta b { color: var(--gold); }
.focus .act { font-size: 16px; font-weight: 500; margin: 6px 0 4px; white-space: pre-wrap; }
.focus .when { font-size: 13px; color: #C9CFDB; }
.focus .btn { margin-top: 12px; }

/* steps */
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.step { background: var(--tint); border-radius: 12px; padding: 12px; }
.step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--navy); font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.step b { display: block; margin-top: 8px; color: var(--navy); }
.step p { font-size: 12.5px; color: var(--grey); margin: 2px 0 0; line-height: 1.45; }

/* learn */
.lcorner { border-radius: var(--radius); padding: 16px; margin-bottom: 12px; position: relative; overflow: hidden; }
.lcorner::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--cc); }
.lcorner .lk { font-size: 10.5px; font-weight: 700; color: var(--cc); letter-spacing: .06em; }
.lcorner h3 { margin: 0 0 4px; color: var(--cc); font-size: 20px; }
.lcorner .tl { font-weight: 500; margin-bottom: 8px; }
.lcorner ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.chain { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.chain .k { color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.chain .links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-weight: 500; }
.chain .links i { color: var(--gold); font-style: normal; }
.scale { display: grid; grid-template-columns: 62px 1fr; gap: 8px 12px; align-items: center; }
.scale .chip { color: #fff; font-weight: 700; text-align: center; border-radius: 8px; padding: 6px 0; font-size: 14px; }
.scale b { display: block; font-size: 14px; }
.scale span { font-size: 12.5px; color: var(--grey); }

/* history */
.hist { display: grid; grid-template-columns: 1fr repeat(4, 34px); gap: 4px; align-items: center; font-size: 13px; padding: 8px 0; border-top: 1px solid var(--line); }
.hist.head { border-top: 0; font-size: 10px; font-weight: 700; color: var(--grey); text-transform: uppercase; padding-top: 0; }
.hist span { text-align: center; }
.hist .lo { color: #A8505A; font-weight: 700; }
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--grey); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; background: var(--cc); }

.past { padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.past .pm { font-size: 12px; color: var(--grey); }
.check { color: #4E8A6E; font-weight: 700; }

.empty { text-align: center; padding: 26px 10px; }
.empty .big { font-size: 17px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }

#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 60; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.lowpick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.lowpick button { border: 1.5px solid var(--cc); background: #fff; color: var(--cc); border-radius: 20px; padding: 5px 12px; font-size: 13px; font-weight: 500; }
.lowpick button.on { background: var(--cc); color: #fff; }
.qlabel { font-weight: 700; color: var(--navy); font-size: 15px; margin-bottom: 8px; display: block; }
