/* English Buddy design system: shared by the student app and the admin dashboard. */
:root {
  color-scheme: light;
  --bg: #f6f3ff;
  --card: #ffffff;
  --ink: #241a3f;
  --muted: #6f6789;
  --faint: #a59fbb;
  --line: #ebe6f6;
  --field: #f8f6fd;

  --brand: #ff6a45;
  --brand-2: #ffa23a;
  --violet: #7a5cff;
  --violet-soft: #efeaff;
  --sky: #3b8cff;
  --sky-soft: #e7f0ff;
  --green: #1fae7a;
  --green-soft: #ddf6ec;
  --amber: #f4a21d;
  --amber-soft: #fff2d6;
  --red: #e5484d;
  --red-soft: #fde7e8;

  --radius: 24px;
  --radius-sm: 16px;
  --shadow: 0 1px 2px rgba(36, 26, 63, .04), 0 10px 30px rgba(36, 26, 63, .07);
  --shadow-lg: 0 24px 60px rgba(36, 26, 63, .18);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  font-family: var(--font);
  color: var(--ink);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; -webkit-font-smoothing: antialiased; background: var(--bg);
  background-image:
    radial-gradient(900px 520px at -15% -10%, #ffe1d3 0%, transparent 60%),
    radial-gradient(800px 520px at 115% -5%, #dbe8ff 0%, transparent 58%),
    radial-gradient(900px 700px at 50% 125%, #ece2ff 0%, transparent 60%);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); font-weight: 700; min-height: 1.4em; margin: 0; }
.mt { margin-top: 16px; }
code { background: var(--violet-soft); padding: 1px 6px; border-radius: 6px; font-size: .92em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 24px; font-weight: 800; font-size: 16px; line-height: 1.1;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff;
  box-shadow: 0 8px 20px rgba(255, 106, 69, .32); transition: transform .12s ease, box-shadow .12s ease, opacity .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(255, 106, 69, .38); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.big { padding: 18px 36px; font-size: 19px; }
.btn.small { padding: 8px 15px; font-size: 14px; }
.btn.secondary { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.secondary:hover { box-shadow: inset 0 0 0 2px #d9d1ef; }
.btn.ghost { background: rgba(255, 255, 255, .75); color: var(--ink); box-shadow: 0 2px 10px rgba(36, 26, 63, .08); backdrop-filter: blur(10px); }
.btn.violet { background: linear-gradient(135deg, #9a7bff, var(--violet)); box-shadow: 0 8px 20px rgba(122, 92, 255, .32); }
.btn.danger { background: var(--red); box-shadow: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--violet); font-weight: 800; text-align: left; }
.link-btn:hover { text-decoration: underline; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h3 { margin: 0 0 12px; font-size: 18px; }
.banner {
  max-width: 720px; margin: 12px auto 0; padding: 10px 14px; border-radius: 14px; font-size: 13px; font-weight: 700;
  background: var(--amber-soft); color: #7a5300; display: flex; gap: 8px; align-items: center;
}

/* ---------- student layout ---------- */
.session-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.session-tools label { font-size: 14px; }
.session-tools select, .voice-settings select { max-width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.session-clock { margin: 0; color: var(--violet); }
.session-clock strong { font-variant-numeric: tabular-nums; font-size: 22px; }
.voice-settings, .usage-panel { margin-top: 16px; padding: 12px; border-radius: var(--radius-sm); background: var(--field); }
.voice-settings summary, .usage-panel summary { cursor: pointer; font-weight: 800; }
.voice-settings label { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.voice-settings p, .usage-panel p { font-size: 13px; overflow-wrap: anywhere; }
.interim-transcript { min-height: 1.5em; text-align: center; color: var(--muted); font-style: italic; }
.interim-transcript:empty { display: none; }
.voice-previews { margin-top: 12px; }
.voice-preview-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.voice-preview-row span { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.voice-preview-row button { flex-shrink: 0; }
.turn-feedback { margin: 6px 0 16px 14px; padding: 8px 14px; border-left: 3px solid var(--green); background: var(--green-soft); border-radius: 8px; font-size: 14px; }
.turn-feedback p { margin: 4px 0; }
.kid-wrap { max-width: 720px; margin: 0 auto; padding: 14px 16px 48px; }
.kid-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 22px; }
.logo svg { width: 40px; height: 40px; }
.logo em { font-style: normal; color: var(--brand); }
.nav-pills { display: flex; gap: 8px; align-items: center; }
.nav-btn { padding: 6px 14px 6px 6px; gap: 8px; }
.nav-btn svg { width: 20px; height: 20px; margin-left: 6px; }
.avatar-chip { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display);
  font-weight: 600; font-size: 15px; color: #fff; background: linear-gradient(135deg, #9a7bff, var(--violet)); }
.icon-only { width: 42px; height: 42px; padding: 0; }
.icon-only svg { width: 20px; height: 20px; }

/* login */
.login-hero { display: flex; justify-content: center; margin-bottom: -46px; position: relative; z-index: 1; }
.login-hero .buddy-svg { width: 150px; height: 150px; }
.login-card { max-width: 440px; margin: 0 auto; padding: 56px 24px 26px; }
.login-card h1 { text-align: center; font-size: 28px; margin: 0; }
.login-card .subtitle { text-align: center; color: var(--muted); margin: 6px 0 22px; font-size: 16px; }
.login-form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field > span { font-weight: 800; font-size: 14px; color: var(--muted); padding-left: 4px; }
.field input, .field select {
  width: 100%; appearance: none; -webkit-appearance: none; padding: 15px 18px; border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: var(--field); font-size: 17px; font-weight: 700; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input::placeholder { color: var(--faint); font-weight: 600; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%236f6789' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center; padding-right: 44px; }
.field input:focus, .field select:focus { border-color: var(--violet); background: #fff; box-shadow: 0 0 0 4px rgba(122, 92, 255, .14); }
.login-form .btn { margin-top: 4px; width: 100%; }

/* talk */
.talk-card { padding: 18px 18px 22px; overflow: hidden; position: relative; }
.goal { display: flex; align-items: center; gap: 12px; }
.goal-star { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: var(--amber-soft); flex: none; }
.goal-text { flex: 1; min-width: 0; }
.progress-label { font-weight: 800; font-size: 15px; margin-bottom: 7px; }
.progress-bar { height: 12px; background: #f0ecf8; border-radius: 99px; overflow: hidden; }
.progress-bar div { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #4fd1a1, var(--green)); transition: width .8s cubic-bezier(.2, .8, .2, 1); }

.stage { position: relative; display: grid; place-items: center; height: 270px; margin: 6px 0 0; --lvl: 0; }
.stage .halo { position: absolute; width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 162, 58, .22), rgba(255, 162, 58, 0) 68%); transition: background .3s; }
.stage .ring { position: absolute; width: 176px; height: 176px; border-radius: 50%; border: 3px solid var(--sky); opacity: 0; }
.buddy-face { position: relative; z-index: 1; transition: transform .25s; }
button.buddy-face { appearance: none; background: transparent; border: 0; padding: 0; border-radius: 50%; touch-action: manipulation; }
button.buddy-face:focus-visible { outline: 3px solid var(--violet); outline-offset: 12px; }
button.buddy-face[data-playback="paused"] { filter: saturate(.8); }
.buddy-svg { width: 176px; height: 176px; display: block; overflow: visible; }
.buddy-svg .body { animation: float 4s ease-in-out infinite; transform-origin: 100px 190px; }
.buddy-svg .eyes { animation: blink 4.6s infinite; transform-box: fill-box; transform-origin: center; }
.buddy-svg .mouth { transform-box: fill-box; transform-origin: center top; transition: transform .2s; }
.buddy-svg .sprout { transform-box: fill-box; transform-origin: bottom center; animation: sway 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

.buddy-face.speaking .mouth { animation: talk .22s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scaleY(.6); } to { transform: scaleY(1.7); } }
.buddy-face.thinking .eyes { animation: look 1.6s ease-in-out infinite; }
.buddy-face.thinking .body { animation: think 1.6s ease-in-out infinite; }
@keyframes look { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(5px, -6px); } }
@keyframes think { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }
.stage.listening .halo { background: radial-gradient(circle, rgba(59, 140, 255, .25), rgba(59, 140, 255, 0) 68%); }
.stage.listening .ring { animation: ripple 2.4s ease-out infinite; }
.stage.listening .ring:nth-child(3) { animation-delay: .8s; }
.stage.listening .ring:nth-child(4) { animation-delay: 1.6s; }
.stage.listening .buddy-face { transform: scale(calc(1 + var(--lvl) * .08)); }
.stage .meter { position: absolute; bottom: 0; display: none; align-items: center; gap: 5px; height: 40px; z-index: 2; }
.stage.listening .meter { display: flex; }
.meter i { width: 7px; border-radius: 99px; background: var(--sky); height: calc(6px + var(--lvl) * 34px * var(--m)); transition: height .08s; }
@keyframes ripple { from { transform: scale(.95); opacity: .55; } to { transform: scale(1.45); opacity: 0; } }

.status-pill {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 auto; width: fit-content; max-width: 100%;
  padding: 10px 18px; border-radius: 999px; background: var(--field); font-weight: 800; font-size: 17px; text-align: center;
  transition: background .2s, color .2s;
}
.status-pill[data-mode="listening"] { background: var(--sky-soft); color: #1a5fc4; }
.status-pill[data-mode="speaking"] { background: #fff0e8; color: #c4431f; }
.status-pill[data-mode="thinking"] { background: var(--violet-soft); color: #5235d6; }
.status-pill[data-mode="thinking"]::after { content: ""; width: 18px; height: 6px;
  background: radial-gradient(circle 3px, currentColor 95%, transparent) 0 0 / 6px 6px repeat-x; animation: dots 1s steps(3) infinite; }
@keyframes dots { from { width: 6px; } to { width: 24px; } }

.controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 18px 0 6px; flex-wrap: wrap; }
.controls .end-call { color: var(--red); border-color: var(--red); }
/* iPhone tap-to-talk: draw the learner's eye to Speak when it is their turn. */
.controls .btn.tap-to-talk { animation: tap-pulse 1.6s ease-in-out infinite; }
@keyframes tap-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(59, 140, 255, .5); } 50% { box-shadow: 0 0 0 10px rgba(59, 140, 255, 0); } }
.volume-tip { display: flex; justify-content: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 8px 0 0; font-weight: 600; text-align: center; }

.celebrate {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius-sm); text-align: center; font-weight: 800; font-size: 17px;
  background: linear-gradient(135deg, #fff4c9, #ffe2cf); color: #7a4a00;
}

/* chat */
.chat-card { margin-top: 16px; padding: 16px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.chat-head h3 { margin: 0; font-size: 16px; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; padding: 2px; scroll-behavior: smooth; }
.chat:empty::before { content: "Your conversation with Buddy will appear here."; color: var(--faint); font-weight: 600; text-align: center; padding: 18px 0; }
.bubble { max-width: 85%; padding: 12px 16px; border-radius: 20px; font-size: 16px; line-height: 1.45; animation: pop .25s ease-out; }
.bubble.buddy { align-self: flex-start; background: #fff4ee; border-bottom-left-radius: 6px; }
.bubble.child { align-self: flex-end; background: linear-gradient(135deg, #5b9dff, var(--sky)); color: #fff; border-bottom-right-radius: 6px; }
.bubble .tr { display: block; font-size: 13px; margin-top: 5px; opacity: .85; }
.bubble.buddy .tr { color: var(--muted); }
@keyframes pop { from { transform: translateY(6px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.type-box { margin-top: 12px; }
.type-box summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 700; list-style: none; }
.type-box summary::-webkit-details-marker { display: none; }
.type-row { display: flex; gap: 8px; margin-top: 10px; }
.type-row input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--field); outline: none; }
.type-row input:focus { border-color: var(--violet); background: #fff; }

/* ---------- report card & profile ---------- */
.medal { position: relative; width: 112px; height: 112px; flex: none; }
.medal::before, .medal::after { content: ""; position: absolute; bottom: -14px; width: 26px; height: 40px; background: var(--violet); z-index: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
.medal::before { left: 28px; transform: rotate(14deg); } .medal::after { right: 28px; transform: rotate(-14deg); background: #9a7bff; }
.medal-face { position: relative; z-index: 1; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; text-align: center;
  background: radial-gradient(circle at 35% 28%, #fff1b8, #ffc93d 55%, #f0a414); box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .45), 0 10px 26px rgba(240, 164, 20, .4); color: #6b3f00; }
.medal-face small { display: block; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.medal-face b { display: block; font-family: var(--display); font-size: 44px; line-height: 1; }
.level-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.level-name { font-family: var(--display); font-size: 24px; font-weight: 600; }
.change { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-weight: 800; border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.change.up { background: var(--green-soft); color: #137a54; }
.change.same { background: var(--sky-soft); color: #1a5fc4; }
.buddy-msg { position: relative; background: #fff4ee; border-radius: 20px; padding: 14px 16px 14px 62px; font-size: 16px; line-height: 1.5; margin: 18px 0; }
.buddy-msg .mini { position: absolute; left: 12px; top: 12px; width: 40px; height: 40px; }
.list-good, .list-tip { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 8px; }
.list-good li, .list-tip li { padding: 10px 12px 10px 40px; border-radius: 14px; position: relative; font-weight: 600; font-size: 15px; }
.list-good li { background: var(--green-soft); } .list-good li::before { content: "✓"; position: absolute; left: 14px; color: var(--green); font-weight: 900; }
.list-tip li { background: var(--amber-soft); } .list-tip li::before { content: "★"; position: absolute; left: 13px; color: var(--amber); }
.sub-h { font-size: 15px; margin: 14px 0 8px; }

.profile-hero { background: linear-gradient(135deg, #8a6bff, #5b8cff); color: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.profile-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.profile-hero h2 { margin: 0; font-size: 24px; }
.profile-hero .meta { opacity: .85; font-weight: 700; margin-top: 2px; }
.profile-hero .level-hero { margin-top: 18px; position: relative; z-index: 1; }
.profile-hero .change { background: rgba(255, 255, 255, .2); color: #fff; }
.profile-hero .buddy-msg { background: rgba(255, 255, 255, .95); color: var(--ink); margin-bottom: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }
.stat .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: none; }
.stat b { display: block; font-size: 19px; font-family: var(--display); font-weight: 600; line-height: 1.15; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 800; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.session-list { display: grid; gap: 10px; }
.session-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: var(--field); }
.session-item .lvl { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 20px; background: var(--amber-soft); color: #8a5a00; flex: none; }
.session-item .lvl.none { background: #eee9f7; color: var(--faint); font-size: 14px; }
.session-item b { display: block; }
.session-item span { font-size: 13px; color: var(--muted); font-weight: 700; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--faint); font-size: 11px; font-family: var(--font); font-weight: 700; }
.chart-cross { stroke: #cfc7e3; stroke-width: 1; stroke-dasharray: 3 3; }
.chart-goal { stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart-tip { position: absolute; display: none; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.4;
  padding: 7px 10px; border-radius: 10px; white-space: nowrap; z-index: 2; box-shadow: 0 6px 16px rgba(36, 26, 63, .25); }
.skill { display: grid; grid-template-columns: 128px 1fr 70px; align-items: center; gap: 10px; margin: 10px 0; font-size: 14px; }
.skill-name { font-weight: 800; }
.skill-track { height: 12px; background: #f0ecf8; border-radius: 99px; overflow: hidden; }
.skill-fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #8fb8ff, var(--sky)); }
.skill-val { font-weight: 900; text-align: right; }
.skill-val .up { color: var(--green); font-style: normal; font-size: 12px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 20; background: rgba(36, 26, 63, .45); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 28px 16px; overflow-y: auto; animation: fade .2s; }
.modal { background: #fff; border-radius: 28px; width: 100%; max-width: 720px; padding: 22px; box-shadow: var(--shadow-lg); animation: rise .3s cubic-bezier(.2, .8, .2, 1); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal .controls { margin-bottom: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* ---------- admin ---------- */
body.admin-body { background: #f6f5fa; background-image: none; }
.admin { max-width: 1200px; margin: 0 auto; padding: 18px 20px 64px; }
.admin h1 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 10px; }
.admin h1 svg { width: 34px; height: 34px; }
.admin .card h3 { font-size: 16px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: #fff; padding: 5px; border-radius: 999px; box-shadow: var(--shadow); }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 800; color: var(--muted); font-size: 14px; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; font-weight: 700; font-size: 14px; color: var(--muted); }
.toolbar label { display: flex; align-items: center; gap: 8px; }
.toolbar input, .toolbar select, .form-row input, .form-row select, .admin-input {
  padding: 9px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; outline: none; }
.toolbar input:focus, .toolbar select:focus, .form-row input:focus, .admin-input:focus { border-color: var(--violet); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: 20px; padding: 16px 18px; box-shadow: var(--shadow); border-top: 4px solid var(--violet); }
.kpi b { display: block; font-size: 30px; font-family: var(--display); font-weight: 600; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 800; }
.kpi.red { border-top-color: var(--red); } .kpi.red b { color: var(--red); }
.kpi.green { border-top-color: var(--green); } .kpi.green b { color: var(--green); }
.kpi.amber { border-top-color: var(--amber); } .kpi.amber b { color: #c27c00; }
.missing { border-left: 6px solid var(--red); }
.missing h3 { margin: 0 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--red-soft); color: #a8282d; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 800; }
.section-title { margin: 26px 0 12px; font-size: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfaff; }
th { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 900; }
.status-pill-sm, .status-pill.not_talked, .status-pill.partial, .status-pill.completed { display: inline-block; border-radius: 999px; padding: 4px 11px; font-weight: 800; font-size: 12px; }
.status-pill.not_talked { background: var(--red-soft); color: #a8282d; }
.status-pill.partial { background: var(--amber-soft); color: #8a5a00; }
.status-pill.completed { background: var(--green-soft); color: #137a54; }
.flag { color: var(--red); font-weight: 900; }
.week td.cell { text-align: center; padding: 6px; }
.week td.cell span { display: inline-block; min-width: 42px; border-radius: 9px; padding: 5px 6px; font-weight: 800; font-size: 12px; }
.upload-card { border: 2px dashed #d9d1ef; box-shadow: none; }
.upload-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.check-ok { color: var(--green); font-weight: 800; }
.check-bad { color: var(--red); font-weight: 800; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
textarea { width: 100%; min-height: 110px; border-radius: 14px; border: 2px solid var(--line); padding: 12px; font: inherit; outline: none; }
textarea:focus { border-color: var(--violet); }
.convo { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.convo .bubble { font-size: 15px; max-width: 92%; }
.convo .chat { max-height: none; }
.lang-tag { font-size: 10px; font-weight: 900; text-transform: uppercase; background: rgba(255, 255, 255, .25); padding: 2px 7px; border-radius: 6px; margin-left: 6px; }
.admin .bubble.child .tr { color: #fff; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .skill { grid-template-columns: 100px 1fr 62px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .modal-bg { padding: 12px 10px; }
  .modal { padding: 18px; border-radius: 24px; }
}
@media (max-width: 380px) {
  .logo { font-size: 19px; }
  .stage { height: 220px; }
  .buddy-svg { width: 150px; height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* developer voice diagnostics (?debug=1) */
.voice-debug { position: fixed; left: 8px; bottom: 8px; z-index: 50; width: min(460px, calc(100vw - 16px)); max-height: 38vh; overflow: auto;
  margin: 0; padding: 8px 10px; border-radius: 10px; background: rgba(20, 16, 40, .88); color: #d7ffe9; font: 11px/1.45 ui-monospace, Menlo, Consolas, monospace; }
