:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1b1a17;
  --muted: #6f6a61;
  --line: #e6e0d6;
  --accent: #1b1a17;
  --good: #1f8a5b;
  --warn: #c2410c;

  --gen: #f08a24;
  --mg: #e2463b;
  --man: #7c4ddb;
  --pro: #2f6fe4;
  --ref: #8796a5;

  --bg-ink: #1b1a17;
  --bg-red: #d8342c;
  --bg-line: #e9e4db;
  --bg-open: #ffffff;
  --bg-edge: #bdb5a8;
  --center-head: #f4d35e;
  --center-ajna: #74c69d;
  --center-throat: #c8a27a;
  --center-g: #f4d35e;
  --center-heart: #e5484d;
  --center-sacral: #e5484d;
  --center-solarPlexus: #c8a27a;
  --center-spleen: #c8a27a;
  --center-root: #c8a27a;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 26, 23, .06), 0 6px 20px rgba(27, 26, 23, .06);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); -webkit-font-smoothing: antialiased; }
main { max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; }
h2 { font-family: 'Bricolage Grotesque', Inter, sans-serif; font-weight: 800; font-size: 24px; letter-spacing: -.01em; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warn { color: var(--warn); }
.right { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 14px/1 Inter, sans-serif; padding: 11px 16px; border-radius: 999px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: transform .08s, background .15s;
}
.btn:hover { background: #fbf9f6; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #2d2b27; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(27, 26, 23, .06); }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn.danger { color: #b42318; }
.btn[disabled] { opacity: .4; cursor: default; }

/* Home */
.hero { padding: 72px 0 40px; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.brand.small { font-size: 13px; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: #f4d35e; font-size: 14px; }
.brand.small .logo { width: 22px; height: 22px; font-size: 11px; border-radius: 6px; }
.hero h1 { font-family: 'Bricolage Grotesque', Inter, sans-serif; font-weight: 800; font-size: clamp(44px, 8vw, 84px); line-height: .95; letter-spacing: -.035em; margin: 28px 0 16px; }
.lede { font-size: 19px; color: var(--muted); max-width: 520px; margin: 0; }
.made-for { margin: 22px 0 0; display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.section { margin-top: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ws-tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s; }
.ws-tile:hover { transform: translateY(-2px); }
.ws-name { font-weight: 700; font-size: 18px; }
.ws-meta { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }
.mixbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--bg-line); }
.mixbar.big { height: 14px; margin-bottom: 14px; }
.seg.gen, .dot.gen, .av.gen { background: var(--gen); }
.seg.mg, .dot.mg, .av.mg { background: var(--mg); }
.seg.man, .dot.man, .av.man { background: var(--man); }
.seg.pro, .dot.pro, .av.pro { background: var(--pro); }
.seg.ref, .dot.ref, .av.ref { background: var(--ref); }
.seg.none { flex: 1; }
.avatars { display: flex; margin-top: 14px; }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; border: 2px solid var(--surface); margin-right: -6px; }
.av.more { background: var(--line); color: var(--muted); }
.empty { background: var(--surface); border: 1px dashed var(--bg-edge); border-radius: var(--radius); padding: 28px; text-align: center; }
.empty.big { padding: 56px 28px; margin-top: 24px; }
.empty.big p { max-width: 480px; margin: 12px auto 20px; color: var(--muted); }
.foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.foot p { margin: 0; }

/* Workspace */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; }
.back { text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.back:hover { color: var(--ink); }
.ws-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 16px 0 20px; }
.ws-title { font-family: 'Bricolage Grotesque', Inter, sans-serif; font-weight: 800; font-size: clamp(32px, 5vw, 48px); letter-spacing: -.03em; }
.ws-head p { margin: 4px 0 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tab { padding: 12px 14px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--ink); border-color: var(--ink); }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.select-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
select, input, textarea { font: inherit; color: inherit; }
.select-label select { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-weight: 600; }

/* Player cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 18px; }
.pcard {
  --t: var(--gen);
  display: flex; flex-direction: column; text-decoration: none; background: var(--surface); border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), var(--shadow); position: relative; transition: transform .14s, box-shadow .14s;
  border-top: 6px solid var(--t);
}
.pcard:hover { transform: translateY(-3px) rotate(-.3deg); box-shadow: 0 0 0 1px var(--line), 0 14px 32px rgba(27, 26, 23, .12); }
.pcard.mg { --t: var(--mg); } .pcard.man { --t: var(--man); } .pcard.pro { --t: var(--pro); } .pcard.ref { --t: var(--ref); }
.pc-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 0; }
.pc-role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--t); }
.pc-profile { font-family: 'Bricolage Grotesque', Inter, sans-serif; font-weight: 800; font-size: 15px; background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 7px; }
.pc-photo { position: relative; margin: 10px 14px 0; height: 118px; border-radius: 12px; background: color-mix(in srgb, var(--t) 14%, #fff); display: flex; align-items: center; padding-left: 16px; overflow: hidden; }
.pc-initials { font-family: 'Bricolage Grotesque', Inter, sans-serif; font-weight: 800; font-size: 52px; letter-spacing: -.04em; color: var(--t); }
.pc-graph { position: absolute; right: 6px; top: 4px; bottom: 4px; }
.pc-graph svg { height: 100%; width: auto; }
.pc-name { font-weight: 800; font-size: 19px; padding: 12px 14px 0; letter-spacing: -.01em; font-family: 'Bricolage Grotesque', Inter, sans-serif; }
.pc-sub { font-size: 12.5px; color: var(--muted); padding: 2px 14px 0; }
.approx { color: var(--warn); font-weight: 700; }
.pc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px 14px 0; }
.stat { background: #f7f5f1; border-radius: 9px; padding: 7px 4px 6px; text-align: center; }
.stat b { display: block; font-family: 'Bricolage Grotesque', Inter, sans-serif; font-size: 21px; font-weight: 800; line-height: 1; }
.stat span { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.stat.top { background: var(--t); color: #fff; }
.stat.top span { color: rgba(255, 255, 255, .85); }
.pc-notes { padding: 12px 14px 0; font-size: 12.5px; line-height: 1.4; flex: 1; }
.pc-notes p { margin: 0 0 8px; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: 5px; padding: 2px 6px; margin-right: 6px; vertical-align: 1px; }
.tag.good { background: #e3f4ea; color: var(--good); }
.tag.work { background: #fdeee4; color: var(--warn); }
.pc-foot { font-size: 11px; color: var(--muted); padding: 8px 14px 12px; border-top: 1px dashed var(--line); margin-top: 4px; }

/* Bodygraph */
.bodygraph { display: block; }
.bodygraph.full { width: 100%; max-width: 330px; margin: 0 auto; }
.bodygraph .gate circle { fill: transparent; }
.bodygraph .gate text { font: 600 8px Inter, sans-serif; text-anchor: middle; fill: #8c8478; }
.bodygraph .gate.on circle { fill: #fff; stroke: var(--ink); stroke-width: 1; }
.bodygraph .gate.on text { fill: var(--ink); font-weight: 700; }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend i.ink { background: var(--bg-ink); } .legend i.red { background: var(--bg-red); }

/* Team */
.team-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.mix-row { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; }
.mix-row b { margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.centers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.center-chip { font-size: 12px; background: #f7f5f1; border-radius: 8px; padding: 7px 8px; display: flex; justify-content: space-between; }
.center-chip.none { background: #fdeee4; color: var(--warn); }
.recs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.rec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-left: 4px solid var(--ink); }
.rec.strength { border-left-color: var(--good); } .rec.watch { border-left-color: var(--warn); } .rec.action { border-left-color: var(--pro); }
.rec-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rec h4 { font-size: 16px; margin: 4px 0 6px; }
.rec p { margin: 0; font-size: 14px; line-height: 1.5; color: #3d3a35; }
.skills { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 18px; margin-top: 14px; }
.skills.compact { border: 0; padding: 0; margin: 0; }
.skill-row { display: grid; grid-template-columns: 110px 1fr 34px minmax(0, 1.4fr); gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.skills.compact .skill-row { grid-template-columns: 100px 1fr 34px; padding: 6px 0; border: 0; }
.skill-row:last-child { border-bottom: 0; }
.skill-name { font-weight: 600; font-size: 14px; }
.skill-bar { height: 8px; background: var(--bg-line); border-radius: 99px; overflow: hidden; }
.skill-bar span { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.skill-avg { font-weight: 800; font-family: 'Bricolage Grotesque', Inter, sans-serif; font-size: 18px; text-align: right; }
.skill-leaders { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.skill-leaders a { text-decoration: none; background: #f7f5f1; border-radius: 99px; padding: 3px 9px; color: var(--ink); font-weight: 600; }
.skill-leaders small { color: var(--muted); font-weight: 500; }
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 12px; }
.pair { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.pair span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* People table */
.table-wrap { overflow-x: auto; }
table.people { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); font-size: 14px; }
table.people th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbfaf7; }
table.people td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.people tr:last-child td { border-bottom: 0; }
table.people a { font-weight: 600; text-decoration: none; }
table.import tr.bad td { background: #fff7f2; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; color: #fff; white-space: nowrap; }
.pill.gen { background: var(--gen); } .pill.mg { background: var(--mg); } .pill.man { background: var(--man); } .pill.pro { background: var(--pro); } .pill.ref { background: var(--ref); }
input.inline { border: 1px solid var(--bg-edge); border-radius: 6px; padding: 4px 6px; width: 100%; min-width: 140px; }

/* Person page */
.person { display: grid; grid-template-columns: 270px 1fr; gap: 28px; align-items: start; }
.person-card { position: sticky; top: 16px; }
.person-card .pcard { pointer-events: none; }
.person-main h1 { font-family: 'Bricolage Grotesque', Inter, sans-serif; font-weight: 800; font-size: 40px; letter-spacing: -.03em; }
.person-main > p { margin: 6px 0 16px; }
.person-main .panel { margin-bottom: 14px; }
.note { background: #fff7e6; border: 1px solid #f5dfb0; border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel ul { margin: 0; padding-left: 18px; line-height: 1.55; font-size: 15px; }
.panel li { margin-bottom: 6px; }
.chart-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; }
.chart-row .panel { margin-bottom: 14px; }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0 0 16px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.chip { display: inline-block; font-size: 12.5px; background: #f7f5f1; border-radius: 99px; padding: 4px 10px; margin: 0 6px 6px 0; }
table.acts { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.acts th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; padding: 4px; }
table.acts td { text-align: center; padding: 4px; border-top: 1px solid var(--line); }
table.acts td.red { color: var(--bg-red); font-weight: 600; }
table.acts td:last-child { font-weight: 600; }

/* Dialog + forms */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .25); color: var(--ink); }
dialog:has(.wide) { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(27, 26, 23, .35); backdrop-filter: blur(2px); }
.form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.form h2 { font-size: 22px; }
.form p { margin: 0; font-size: 14px; line-height: 1.5; color: #3d3a35; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; position: relative; }
.form input:not([type=file]), .form select, .form textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 15px; font-weight: 400; background: #fff; width: 100%; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.form textarea { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.form details summary { font-size: 13px; color: var(--muted); cursor: pointer; }
.form details label { margin-top: 10px; }
.preview { min-height: 20px; font-size: 13px !important; color: var(--muted) !important; }
.suggest { display: flex; flex-direction: column; }
.suggest:not(:empty) { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.suggest button { text-align: left; border: 0; background: #fff; padding: 9px 12px; font: 500 14px Inter, sans-serif; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover { background: #f7f5f1; }
.suggest .muted { font-size: 12px; margin-left: 6px; }
.suggest > div { padding: 9px 12px; }

@media (max-width: 860px) {
  .person { grid-template-columns: 1fr; }
  .person-card { position: static; max-width: 300px; }
  .chart-row, .two { grid-template-columns: 1fr; }
  .skill-row { grid-template-columns: 90px 1fr 30px; }
  .skill-leaders { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  main { padding: 0 16px 48px; }
  .hero { padding-top: 40px; }
  .ws-head .row .btn { flex: 1; justify-content: center; }
}

@media print {
  body { background: #fff; }
  .topbar, .ws-head, .tabs, .toolbar { display: none; }
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .pcard { break-inside: avoid; box-shadow: 0 0 0 1px #ccc; }
}
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; }
.link:hover { color: var(--ink); }
