@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Figtree:wght@400;500;600;700&display=swap");

:root {
  --paper: #f6f4fa;
  --surface: #ffffff;
  --ink: #28214a;
  --ink-soft: #5b5480;
  --line: #e4e0ef;
  --honey: #f2b705;
  --honey-deep: #c98f00;
  --honey-wash: #fff4d1;
  --mint: #22a57a;
  --mint-wash: #e2f6ee;
  --berry: #d9434a;
  --berry-wash: #fde8e9;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --display: "Fredoka", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; font-weight: 600; }
h1 { font-size: 2rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; border-radius: 6px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--ink);
  color: #efeaff;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand img, .brand .logo { width: 44px; height: 44px; border-radius: 14px; background: var(--honey); flex: none; }
.brand .logo { display: grid; place-items: center; font-size: 24px; }
.brand b { font-family: var(--display); font-size: 1.25rem; font-weight: 600; display: block; }
.brand small { color: #b7aedd; font-size: 0.8125rem; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: #d9d2f5;
}
.nav button:hover { background: rgba(255, 255, 255, 0.07); }
.nav button[aria-current="page"] { background: var(--honey); color: var(--ink); }
.nav button:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
.nav .ico { width: 22px; text-align: center; }
.nav-label { font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: #8d84b8; padding: 14px 12px 4px; font-weight: 700; }
.nav-label:first-child { padding-top: 0; }
.side { overflow-y: auto; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px; font-size: 0.875rem; }
.me img { width: 32px; height: 32px; border-radius: 50%; }
.me a { color: #b7aedd; font-size: 0.8125rem; }

main { padding: 40px 48px 64px; max-width: 1080px; width: 100%; min-width: 0; }
.shell > * { min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.head p { color: var(--ink-soft); margin-top: 6px; max-width: 60ch; }

/* ---------- blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.panel + .panel, .stack > * + * { margin-top: 20px; }
.panel h2 { margin-bottom: 4px; }
.panel > .sub { color: var(--ink-soft); font-size: 0.9375rem; margin-bottom: 18px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.875rem; }

.btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: #3a3166; }
.btn.honey { background: var(--honey); color: var(--ink); }
.btn.honey:hover { background: #ffc61a; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 2px var(--ink-soft); }
.btn.danger { background: transparent; color: var(--berry); box-shadow: inset 0 0 0 2px var(--berry-wash); }
.btn.danger:hover { background: var(--berry-wash); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; margin-bottom: 18px; }
.confirm-text { margin: 10px 0 22px; }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; align-items: start; }
.form .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9375rem; }
.panel h2 + .form { margin-top: 14px; }
label.f span { font-weight: 400; color: var(--ink-soft); font-size: 0.8125rem; }
input, select, textarea {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--honey); outline: none; }
textarea { min-height: 84px; resize: vertical; }
select[multiple] { min-height: 120px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; cursor: pointer; padding: 4px 0; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--ink); }
.check small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 0.8125rem; }
.checks { display: grid; gap: 4px 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .checks { grid-template-columns: 1fr; } }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; color: inherit !important; font-size: inherit !important; }
.grow { flex: 1 1 240px; width: auto; min-width: 0; }
.stack-sm > * + * { margin-top: 10px; }
.mt { margin-top: 20px; }
.reward { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: end; }
.reward.step { grid-template-columns: 110px 1fr 140px auto; }
.reward .btn { padding: 10px 14px; margin-bottom: 2px; }
.picker { position: relative; }
.picker .results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.picker .results button { all: unset; cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.picker .results button:hover, .picker .results button:focus-visible { background: var(--paper); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.tile span { display: block; font-size: 0.8125rem; color: var(--ink-soft); }
.tile b { font-family: var(--display); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- jam timeline (the signature element) ---------- */
.track { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); position: relative; }
.track::before, .track .fill {
  content: "";
  position: absolute;
  top: 21px;
  left: 12.5%;
  height: 8px;
  border-radius: 8px;
}
.track::before { right: 12.5%; background: var(--line); }
.track .fill { background: var(--honey); width: 0; transition: width 0.8s cubic-bezier(.2, .8, .2, 1); }
.track li { text-align: center; position: relative; z-index: 1; padding: 0 6px; }
.track .dot {
  width: 50px; height: 50px; margin: 0 auto 10px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 1.25rem;
  background: var(--surface);
  border: 4px solid var(--line);
  color: var(--ink-soft);
}
.track li.done .dot { background: var(--honey); border-color: var(--honey); color: var(--ink); }
.track li.now .dot { border-color: var(--honey); color: var(--ink); box-shadow: 0 0 0 6px var(--honey-wash); }
.track b { display: block; font-family: var(--display); font-weight: 600; }
.track time { display: block; font-size: 0.875rem; color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .track .fill { transition: none; } }

.theme-chip { display: inline-flex; gap: 8px; align-items: center; background: var(--honey-wash); border-radius: 999px;
  padding: 6px 14px; font-weight: 600; }

/* ---------- lists & tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.8125rem; color: var(--ink-soft); font-weight: 600; padding: 0 12px 10px; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: top; }
td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border-radius: 999px; padding: 3px 10px 3px 3px; font-size: 0.875rem; }
.person img, .person i { width: 22px; height: 22px; border-radius: 50%; background: var(--line); display: inline-block; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.8125rem; font-weight: 600; background: var(--paper); color: var(--ink-soft); }
.tag.ok { background: var(--mint-wash); color: var(--mint); }
.tag.warn { background: var(--honey-wash); color: var(--honey-deep); }
.tag.bad { background: var(--berry-wash); color: var(--berry); }
.score { font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.medal { font-size: 1.25rem; }
.bar { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; min-width: 120px; }
.bar i { display: block; height: 100%; background: var(--mint); border-radius: 8px; }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-soft); }
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 1.125rem; margin-bottom: 4px; }

pre.transcript { white-space: pre-wrap; word-break: break-word; background: var(--paper); border-radius: var(--radius-sm); padding: 16px;
  max-height: 60vh; overflow: auto; font-size: 0.875rem; margin: 0; }

dialog { border: 0; border-radius: var(--radius-lg); padding: 24px; width: min(720px, 92vw); color: var(--ink); }
dialog::backdrop { background: rgba(40, 33, 74, 0.45); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600;
  transition: transform 0.25s ease, visibility 0s linear 0.25s; z-index: 50; max-width: 90vw; visibility: hidden;
}
.toast.show { transform: translateX(-50%) translateY(0); visibility: visible; transition: transform 0.25s ease; }
.toast.err { background: var(--berry); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.login .card { background: var(--surface); border-radius: 28px; padding: 40px; max-width: 420px; width: 100%; text-align: center; }
.login .paw { width: 88px; height: 88px; border-radius: 28px; background: var(--honey); display: grid; place-items: center; margin: 0 auto 20px; font-size: 44px; }
.login p { color: var(--ink-soft); margin: 10px 0 24px; }
.login .note { margin-top: 18px; font-size: 0.875rem; color: var(--berry); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 16px; gap: 14px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav button { white-space: nowrap; }
  .me { display: none; }
  main { padding: 24px 16px 48px; }
  .split, .form { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .nav-label { display: none; }
  .reward, .reward.step { grid-template-columns: 1fr 1fr; }
  .reward .btn { justify-self: start; }
  .track { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
  .track::before, .track .fill { display: none; }
  table { display: block; overflow-x: auto; }
}

/* ---------- spacing between blocks ---------- */
main > * + * { margin-top: 20px; }
.actions { margin-top: 20px; }
.split > .panel { margin-top: 0; }
