:root {
  --bg: #f6f4ff;
  --ink: #1e2250;
  --ink-2: #3c4175;
  --muted: #6e7399;
  --card: #ffffff;
  --line: #e9e6fb;
  --primary: #6c5ce7;
  --primary-600: #5848d6;
  --primary-50: #efecff;
  --sky: #3fa9f5;
  --mint: #1fc9a0;
  --sun: #ffbe2e;
  --coral: #ff6b81;
  --pink: #f783ac;
  --orange: #ff922b;
  --grad: linear-gradient(135deg, #6c5ce7 0%, #3fa9f5 100%);
  --grad-warm: linear-gradient(135deg, #ff6b81 0%, #ffbe2e 100%);
  --grad-mint: linear-gradient(135deg, #1fc9a0 0%, #3fa9f5 100%);
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 8px rgba(76, 61, 180, 0.07);
  --shadow: 0 10px 30px rgba(76, 61, 180, 0.10);
  --shadow-lg: 0 24px 60px rgba(76, 61, 180, 0.18);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar: 268px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito Variable', 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 8% -10%, #e5defe 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 0%, #d8f0ff 0%, transparent 55%),
    radial-gradient(900px 600px at 50% 120%, #ffe9ef 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(108, 92, 231, .45); outline-offset: 2px; border-radius: 10px; }

/* ---------- animated background ---------- */
.blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blobs i { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; animation: float 22s ease-in-out infinite; }
.blobs i:nth-child(1) { width: 380px; height: 380px; background: #c9bcff; top: -80px; left: -60px; }
.blobs i:nth-child(2) { width: 320px; height: 320px; background: #a5dcff; top: 30%; right: -80px; animation-delay: -6s; animation-duration: 26s; }
.blobs i:nth-child(3) { width: 300px; height: 300px; background: #ffd0dc; bottom: -80px; left: 25%; animation-delay: -12s; }
.blobs i:nth-child(4) { width: 220px; height: 220px; background: #fff0b3; top: 55%; left: -60px; animation-delay: -3s; animation-duration: 30s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, 30px) scale(1.08); }
  66% { transform: translate(-30px, 50px) scale(.94); }
}

/* ---------- buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--h); padding: 0 1.15rem;
  border: 0; border-radius: 14px; cursor: pointer;
  font: inherit; font-weight: 800; font-size: .95rem; color: var(--ink);
  background: #fff; box-shadow: inset 0 0 0 2px var(--line);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, opacity .18s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 2px #d7d2fa, var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { color: #fff; background: var(--grad); box-shadow: 0 8px 20px rgba(88, 72, 214, .32); }
.btn-primary:hover { box-shadow: 0 12px 26px rgba(88, 72, 214, .42); }
.btn-soft { background: var(--primary-50); color: var(--primary-600); box-shadow: none; }
.btn-soft:hover { background: #e4dfff; box-shadow: none; }
.btn-danger { background: #fff1f3; color: #d6336c; box-shadow: none; }
.btn-danger:hover { background: #ffe0e6; box-shadow: none; }
.btn-danger-solid { color: #fff; background: linear-gradient(135deg, #ff6b81, #f03e6e); box-shadow: 0 8px 20px rgba(240, 62, 110, .3); }
.btn-lg { --h: 52px; padding: 0 1.6rem; font-size: 1.05rem; border-radius: 16px; }
.btn-sm { --h: 36px; padding: 0 .85rem; font-size: .85rem; border-radius: 11px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0;
  border: 0; border-radius: 12px; cursor: pointer; color: var(--ink-2); background: transparent;
  transition: background .15s, color .15s, transform .15s var(--ease);
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--primary-50); color: var(--primary-600); transform: translateY(-1px); }
.icon-btn.danger:hover { background: #fff1f3; color: #d6336c; }
.icon-btn.active { background: var(--primary-50); color: var(--primary-600); }

/* ---------- forms ---------- */
.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field > label, .field > .label { font-weight: 800; font-size: .88rem; color: var(--ink-2); }
.input, .select, textarea.input {
  width: 100%; min-height: 46px; padding: 0 1rem;
  font: inherit; font-weight: 600; color: var(--ink);
  background: #fbfaff; border: 2px solid var(--line); border-radius: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: #aaa9c9; font-weight: 500; }
.input:hover, .select:hover { border-color: #d7d2fa; }
.input:focus, .select:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(108, 92, 231, .14); }
.select { appearance: none; padding-right: 2.4rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e7399' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9rem center; }
.input-group { position: relative; display: flex; gap: .5rem; align-items: center; }
.input-group .input { flex: 1; min-width: 0; }
.input-group .icon-btn { flex: none; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 14px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 2.7rem; }
.hint { font-size: .82rem; color: var(--muted); }
.error-text { color: #d6336c; font-weight: 700; font-size: .9rem; min-height: 1.3em; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.switch { position: relative; display: inline-flex; align-items: center; gap: .7rem; cursor: pointer; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 46px; height: 28px; border-radius: 99px; background: #d9d6f2; position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .25s var(--ease); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid rgba(108, 92, 231, .45); outline-offset: 2px; }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; }
.chip { border: 2px solid var(--line); background: #fff; padding: .25rem .8rem; border-radius: 99px; font: inherit; font-weight: 800; font-size: .85rem; color: var(--ink-2); cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- cards / pills ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; border: 1px solid rgba(233, 230, 251, .8); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .65rem; border-radius: 99px; font-size: .78rem; font-weight: 800; background: var(--primary-50); color: var(--primary-600); white-space: nowrap; }
.pill svg { width: 13px; height: 13px; }
.pill.green { background: #dcfaf0; color: #0b8f6c; }
.pill.red { background: #ffe6eb; color: #d6336c; }
.pill.yellow { background: #fff3cf; color: #a66a00; }
.pill.gray { background: #eceaf6; color: #6e7399; }
.pill.sky { background: #e0f2ff; color: #1c7ed6; }

/* ---------- auth / centered pages ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(440px, 100%); padding: 2.4rem 2rem 2rem; text-align: center; animation: pop .6s var(--ease) both; }
.auth-card form { text-align: left; margin-top: 1.5rem; }
.auth-card h1 { margin-top: 1rem; }
.auth-card .tagline { margin-top: .35rem; }
.big-emoji { font-size: 3.5rem; line-height: 1; margin-bottom: .5rem; animation: bob 3s ease-in-out infinite; }
.logo-mark { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 14px 30px rgba(88, 72, 214, .35); animation: bob 3.5s ease-in-out infinite; }
.logo-mark svg { width: 32px; height: 32px; }
.logo-mark.sm { width: 42px; height: 42px; border-radius: 14px; animation: none; box-shadow: 0 8px 18px rgba(88, 72, 214, .3); }
.logo-mark.sm svg { width: 22px; height: 22px; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.doodles { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.doodles span { position: absolute; font-size: 2rem; opacity: .85; animation: bob 5s ease-in-out infinite; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.25rem;
  background: rgba(255, 255, 255, .72); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .75rem; padding: .25rem .5rem; font-weight: 900; font-size: 1.2rem; letter-spacing: -.01em; text-decoration: none; color: var(--ink); }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: grid; gap: .3rem; }
.nav-title { margin: .8rem .75rem .2rem; font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: #a3a1c6; }
.nav a {
  display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: 14px;
  color: var(--ink-2); font-weight: 800; text-decoration: none; transition: background .15s, color .15s, transform .15s var(--ease);
}
.nav a svg { width: 20px; height: 20px; }
.nav a:hover { background: var(--primary-50); color: var(--primary-600); transform: translateX(3px); }
.nav a.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(88, 72, 214, .3); }
.sidebar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: .7rem; padding: .6rem; border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.user-chip .who { min-width: 0; flex: 1; line-height: 1.2; }
.user-chip .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who small { display: block; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { --c: var(--primary); width: 40px; height: 40px; flex: none; border-radius: 14px; display: grid; place-items: center; color: #fff; font-weight: 900; background: var(--c); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: .85rem; }
.main { padding: 2rem clamp(1rem, 3vw, 2.75rem) 7rem; min-width: 0; max-width: 1280px; width: 100%; margin: 0 auto; }
.mobile-bar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; animation: rise .5s var(--ease) both; }
.page-head p { margin-top: .3rem; }
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.4s ease-in-out infinite; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 420px; }
.seg { display: inline-flex; padding: 4px; background: #fff; border-radius: 14px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; width: 38px; height: 34px; border-radius: 10px; cursor: pointer; color: var(--muted); display: grid; place-items: center; transition: all .15s; }
.seg button svg { width: 18px; height: 18px; }
.seg button.on { background: var(--primary-50); color: var(--primary-600); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); animation: rise .5s var(--ease) both; }
.empty .big-emoji { font-size: 4rem; }
.empty h3 { color: var(--ink); margin-bottom: .3rem; }
.skeleton { height: 150px; border-radius: 22px; background: linear-gradient(90deg, #efecff 25%, #f8f6ff 50%, #efecff 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
/* ---------- modal / toast ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 1rem; background: rgba(30, 34, 80, .42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s ease both; overflow: auto; }
.backdrop.closing { animation: fade .15s ease reverse both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: #fff; border-radius: 26px; box-shadow: var(--shadow-lg); padding: 1.6rem; animation: pop .35s var(--ease) both; }
.modal.wide { width: min(640px, 100%); }
.modal-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.modal-head h2 { flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.toasts { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: .5rem; justify-items: center; pointer-events: none; width: min(460px, calc(100vw - 2rem)); }
.toast { display: flex; align-items: center; gap: .6rem; padding: .75rem 1.1rem; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: var(--shadow-lg); animation: toast-in .4s var(--ease) both; pointer-events: auto; }
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: #63e6be; }
.toast.err { background: #c2255c; }
.toast.out { animation: toast-in .25s ease reverse both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.95); } }
canvas.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 100; pointer-events: none; }
.powered { margin-top: 1.5rem; font-size: .82rem; color: var(--muted); font-weight: 700; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-105%); transition: transform .3s var(--ease); background: rgba(255,255,255,.96); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 45; background: rgba(30, 34, 80, .35); backdrop-filter: blur(3px); animation: fade .2s both; }
  .mobile-bar { display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 30; padding: .6rem 1rem; background: rgba(255,255,255,.8); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .mobile-bar .brand { padding: 0; font-size: 1.05rem; }
  .main { padding-top: 1.25rem; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- report app additions ---------- */
body { font-family: 'Nunito Variable', 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
h1, h2, h3, .brand, .display { font-family: 'Fredoka Variable', 'Fredoka', 'Nunito', system-ui, sans-serif; letter-spacing: 0; }
h1, h2, h3 { font-weight: 600; }
.mascot { display: block; margin: 0 auto; height: auto; animation: bob 3.5s ease-in-out infinite; filter: drop-shadow(0 12px 14px rgba(88, 72, 214, .22)); }
.brand .mascot { width: 40px; animation: none; filter: none; margin: 0; }
.mobile-bar .brand .mascot { width: 32px; }
.nav a .nav-ico { font-size: 1.2rem; width: 20px; text-align: center; line-height: 1; }
.new-btn { margin: .25rem .25rem 0; }
.note { display: flex; gap: .7rem; padding: .9rem 1rem; border-radius: 16px; background: #fff8e1; color: #7a5200; font-size: .9rem; font-weight: 600; text-align: left; }
.note svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.pill.lv1 { background: #ffe3e8; color: #c2255c; } .pill.lv2 { background: #ffe8cc; color: #c25e00; } .pill.lv3 { background: #fff3bf; color: #8a6d00; }
.pill.lv4 { background: #e9fac8; color: #4c7a0f; } .pill.lv5 { background: #c3fae8; color: #087f5b; } .pill.lv6 { background: #d0ebff; color: #1864ab; }
.pill.lv7 { background: #dbe4ff; color: #364fc7; } .pill.lv8 { background: #e5dbff; color: #5f3dc4; } .pill.lv9 { background: #f3d9fa; color: #862e9c; }
