/* ============================================================
   Goals v2 — design system
   Ewolucja tożsamości v1: dark glass, gradient indygo→fiolet.
   Mobile-first, bottom-nav na mobile, brak przeładowań strony.
   ============================================================ */

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --card: rgba(26, 26, 36, .82);
  --card-hover: rgba(35, 35, 50, .92);
  --glass: rgba(255, 255, 255, .04);
  --text: #f5f5f7;
  --text2: #9a9aa2;
  --text3: #64646c;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --accent-glow: rgba(99, 102, 241, .35);
  --border: rgba(255, 255, 255, .08);
  --border2: rgba(255, 255, 255, .17);
  --must: #f97316;
  --must-bg: rgba(249, 115, 22, .14);
  --maybe: #a1a1aa;
  --maybe-bg: rgba(161, 161, 170, .12);
  --pass: #52525b;
  --pass-bg: rgba(82, 82, 91, .12);
  --done: #10b981;
  --done-bg: rgba(16, 185, 129, .14);
  --ai: #3b82f6;
  --ai-bg: rgba(59, 130, 246, .12);
  --danger: #f87171;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --nav-h: 62px;
  --hdr-bg: rgba(10, 10, 15, .82);
  --nav-bg: rgba(13, 13, 20, .92);
  --page-glow: rgba(99, 102, 241, .16);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);
  --skel1: #1a1a24; --skel2: #22222e;
}

/* ---------- Motyw JASNY (data-theme="light" na <html>) ---------- */
:root[data-theme="light"] {
  --bg: #f6f7fb;
  --bg2: #ffffff;
  --bg3: #eef0f6;
  --card: rgba(255, 255, 255, .86);
  --card-hover: #ffffff;
  --glass: rgba(20, 22, 40, .035);
  --text: #14151b;
  --text2: #565a6b;
  --text3: #9096a6;
  --accent: #5a5fe0;
  --accent2: #8b5cf6;
  --grad: linear-gradient(135deg, #5a5fe0 0%, #8b5cf6 50%, #a855f7 100%);
  --accent-glow: rgba(99, 102, 241, .22);
  --border: rgba(20, 22, 40, .1);
  --border2: rgba(20, 22, 40, .18);
  --must: #e8590c; --must-bg: rgba(232, 89, 12, .1);
  --maybe: #6b7280; --maybe-bg: rgba(107, 114, 128, .1);
  --pass: #9ca3af; --pass-bg: rgba(156, 163, 175, .12);
  --done: #059669; --done-bg: rgba(5, 150, 105, .1);
  --ai: #2563eb; --ai-bg: rgba(37, 99, 235, .1);
  --danger: #dc2626;
  --hdr-bg: rgba(255, 255, 255, .82);
  --nav-bg: rgba(255, 255, 255, .93);
  --page-glow: rgba(99, 102, 241, .1);
  --shadow-lg: 0 8px 32px rgba(30, 34, 60, .16);
  --skel1: #eef0f6; --skel2: #e2e5ee;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* atrybut hidden ZAWSZE ukrywa (inaczej display:flex/grid go nadpisuje) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(ellipse 90% 45% at 50% -10%, var(--page-glow), transparent);
  background-attachment: fixed;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  transition: background-color .3s ease, color .3s ease;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
img { max-width: 100%; display: block; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 14px; }

/* ---------- Header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: var(--hdr-bg);
  border-bottom: 1px solid var(--border);
}
.hdr-in {
  max-width: 860px; margin: 0 auto; padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
}
.logo {
  font-weight: 900; font-size: 19px; letter-spacing: -.5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; white-space: nowrap;
}
.hdr-stats { font: 600 12px var(--mono); color: var(--text2); white-space: nowrap; }
.hdr-stats b { color: var(--done); }
.hdr-spacer { flex: 1; }
.premium-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--r-full);
  font: 700 12px var(--mono); letter-spacing: .3px;
  color: var(--accent2); background: rgba(139, 92, 246, .12);
  border: 1px solid rgba(139, 92, 246, .32);
  white-space: nowrap; transition: background .15s, transform .1s;
}
.premium-badge:hover { background: rgba(139, 92, 246, .22); }
.premium-badge:active { transform: scale(.96); }
@media (max-width: 420px) { .premium-badge { padding: 6px 9px; } .premium-badge span.lbl { display: none; } }
.hdr-btn {
  position: relative; width: 38px; height: 38px; border-radius: var(--r-md);
  display: grid; place-items: center; font-size: 17px;
  border: 1px solid var(--border); background: var(--glass);
  transition: border-color .15s;
}
.hdr-btn:hover { border-color: var(--border2); }
.hdr-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--must); box-shadow: 0 0 6px var(--must);
}
/* przełącznik motywu — pokazuje ikonę stanu, do którego przełączy */
.theme-toggle .ti-dark, .theme-toggle .ti-light { line-height: 1; }
:root[data-theme="dark"] .theme-toggle .ti-dark { display: none; }
:root[data-theme="light"] .theme-toggle .ti-light { display: none; }

/* ---------- Avatary ---------- */
.av {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font: 700 12px var(--mono); color: #fff;
  flex-shrink: 0; user-select: none;
}
.av-sm { width: 24px; height: 24px; font-size: 10px; }
.av-lg { width: 44px; height: 44px; font-size: 16px; }
.av-stack { display: flex; align-items: center; }
.av-stack .av { margin-left: -8px; border: 2px solid var(--bg2); }
.av-stack .av:first-child { margin-left: 0; }
.av-more {
  margin-left: -8px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--bg2);
  display: inline-grid; place-items: center;
  font: 600 10px var(--mono); color: var(--text2);
}

/* ---------- Badge statusu ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font: 700 11px var(--mono); letter-spacing: .5px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-MUST  { color: var(--must);  background: var(--must-bg);  border-color: rgba(249,115,22,.35); }
.badge-MAYBE { color: var(--maybe); background: var(--maybe-bg); border-color: rgba(161,161,170,.3); }
.badge-PASS  { color: var(--pass);  background: var(--pass-bg);  border-color: rgba(82,82,91,.3); }
.badge-DONE  { color: var(--done);  background: var(--done-bg);  border-color: rgba(16,185,129,.35); }
.badge-ai    { color: var(--ai);    background: var(--ai-bg);    border-color: rgba(59,130,246,.3); }

/* ---------- Karta celu ---------- */
.goal-card {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 12px;
  margin-bottom: 10px; transition: border-color .15s, background .15s;
  position: relative;
}
.goal-card:hover { border-color: var(--border2); background: var(--card-hover); }
.goal-thumb {
  width: 72px; height: 72px; border-radius: var(--r-md);
  object-fit: cover; flex-shrink: 0; background: var(--bg3);
}
.goal-thumb-ph {
  width: 72px; height: 72px; border-radius: var(--r-md); flex-shrink: 0;
  display: grid; place-items: center; font-size: 26px;
}
.goal-main { flex: 1; min-width: 0; }
.goal-name { font-weight: 700; font-size: 15px; line-height: 1.35; margin-bottom: 6px; }
.goal-card.is-done .goal-name { color: var(--text2); }
.goal-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.goal-meta .cnt { font: 600 11.5px var(--mono); color: var(--text2); display: inline-flex; align-items: center; gap: 4px; }
.goal-meta .cnt.hot { color: var(--must); }
.goal-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* ---------- Status picker (segmented) ---------- */
.status-picker { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-full); overflow: hidden; background: var(--bg2); }
.status-picker button {
  padding: 8px 13px; font: 700 11px var(--mono); color: var(--text3);
  min-height: 36px; transition: color .12s, background .12s;
}
.status-picker button:not(:last-child) { border-right: 1px solid var(--border); }
.status-picker button.on-MUST  { color: var(--must);  background: var(--must-bg); }
.status-picker button.on-MAYBE { color: var(--maybe); background: var(--maybe-bg); }
.status-picker button.on-PASS  { color: var(--pass);  background: var(--pass-bg); }
.status-picker button.on-DONE  { color: var(--done);  background: var(--done-bg); }
/* wariant pełnej szerokości (detal celu + landing) — duże cele dotykowe */
.status-picker.picker-lg { display: flex; width: 100%; }
.status-picker.picker-lg button { flex: 1; padding: 13px 6px; min-height: 48px; font-size: 12.5px; }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-md);
  font-weight: 700; font-size: 14px; min-height: 42px;
  border: 1px solid var(--border); background: var(--glass);
  transition: border-color .15s, transform .1s, opacity .15s;
}
.btn:hover { border-color: var(--border2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 4px 20px var(--accent-glow); }
.btn-ghost { border-color: transparent; color: var(--text2); }
.btn-danger { color: var(--danger); border-color: rgba(248,113,113,.3); }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 12.5px; border-radius: var(--r-sm); }

/* ---------- Inputy ---------- */
.input, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: var(--r-md);
  background: var(--bg2); border: 1px solid var(--border);
  font-size: 15px; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text3); }
textarea.input { resize: vertical; min-height: 90px; }
.field { margin-bottom: 16px; }
.field label { display: block; font: 600 12px var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--text2); margin-bottom: 7px; }

/* ---------- Sekcje / listy ---------- */
.section-title {
  font: 700 12px var(--mono); letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text2); margin: 24px 0 12px; display: flex; align-items: center; gap: 8px;
}
.section-title .line { flex: 1; height: 1px; background: var(--border); }
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px; margin-bottom: 14px;
}
.panel h3 { font-size: 15px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ---------- Filtry / pills ---------- */
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  padding: 7px 14px; border-radius: var(--r-full); white-space: nowrap;
  font: 600 12.5px var(--mono); color: var(--text2);
  border: 1px solid var(--border); background: var(--glass);
  min-height: 34px; display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s; flex-shrink: 0;
}
.pill.active { color: var(--accent2); border-color: var(--accent); background: rgba(99,102,241,.12); }

/* ---------- Search ---------- */
.searchbar { position: relative; margin-top: 12px; }
.searchbar .input { padding-left: 40px; }
.searchbar .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 15px; }

/* ---------- Bottom nav (mobile-first) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--nav-bg); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font: 600 10px var(--mono); letter-spacing: .5px; color: var(--text3);
  padding: 6px 10px; min-width: 56px; border-radius: var(--r-md);
}
.bnav-item .ico { font-size: 20px; line-height: 1; }
.bnav-item.active { color: var(--accent2); }
.bnav-add {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--grad); display: grid; place-items: center;
  font-size: 26px; color: #fff; margin-top: -22px;
  box-shadow: 0 6px 24px var(--accent-glow); border: 3px solid var(--bg);
}

/* ---------- Toasty ---------- */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(94vw, 420px); }
.toast {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r-md); padding: 12px 16px; font-size: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  animation: toast-in .25s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.err { border-color: rgba(248,113,113,.45); }
.toast.ok { border-color: rgba(16,185,129,.45); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- Modal / sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px); display: grid; place-items: end center;
  animation: fade-in .2s ease;
}
.sheet {
  width: min(100vw, 560px); max-height: 88vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border2); border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up .25s ease;
}
.sheet h3 { font-size: 17px; font-weight: 800; margin-bottom: 14px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Czat AI ---------- */
.chat-box { display: flex; flex-direction: column; gap: 10px; }
.chat-msgs { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.chat-msg { max-width: 86%; padding: 10px 14px; border-radius: var(--r-lg); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.chat-msg.user { align-self: flex-end; background: rgba(99,102,241,.18); border: 1px solid rgba(99,102,241,.3); }
.chat-msg.assistant { align-self: flex-start; background: var(--bg3); border: 1px solid var(--border); }
.chat-msg.pending { color: var(--text2); font-style: italic; }
.chat-form { display: flex; gap: 8px; }
.chat-form .input { flex: 1; }

/* ---------- Detal celu ---------- */
.goal-hero { position: relative; border-radius: var(--r-xl); overflow: hidden; margin-top: 14px; border: 1px solid var(--border); }
.goal-hero img { width: 100%; height: 240px; object-fit: cover; }
.goal-hero .ph { width: 100%; height: 180px; display: grid; place-items: center; font-size: 54px; }
.goal-hero .shade { position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(10,10,15,.92)); }
.goal-hero .over { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px; }
.goal-hero h1 { font-size: clamp(20px, 5vw, 30px); font-weight: 900; letter-spacing: -.5px; line-height: 1.2; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.kv { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.kv .item { font: 600 12px var(--mono); color: var(--text2); display: flex; align-items: center; gap: 5px; }

/* ---------- AI opis ---------- */
.ai-desc .tldr { font-size: 15px; color: var(--text); margin-bottom: 10px; }
.ai-desc .details { font-size: 14px; color: var(--text2); margin-bottom: 12px; }
.ai-steps { list-style: none; counter-reset: step; margin: 10px 0; }
.ai-steps li { counter-increment: step; position: relative; padding: 6px 0 6px 34px; font-size: 14px; color: var(--text2); }
.ai-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.4);
  color: var(--accent2); font: 700 11px var(--mono);
  display: grid; place-items: center;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 4px 11px; border-radius: var(--r-full); background: var(--glass); border: 1px solid var(--border); font-size: 12.5px; color: var(--text2); }

/* ---------- Komentarze ---------- */
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.comment:last-child { border-bottom: none; }
.comment .body { flex: 1; min-width: 0; }
.comment .who { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.comment .who span { font: 400 11px var(--mono); color: var(--text3); margin-left: 8px; }
.comment .txt { font-size: 14px; color: var(--text2); white-space: pre-wrap; word-break: break-word; }

/* ---------- Uczestnicy ---------- */
.people-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.people-row:last-child { border-bottom: none; }
.people-row .nm { flex: 1; font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Match card (bratnie dusze) ---------- */
.match-card { display: flex; align-items: flex-start; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; }
.match-card .info { flex: 1; min-width: 0; }
.match-card .nm { font-weight: 800; font-size: 16px; }
.match-card .score { font: 600 12px var(--mono); color: var(--must); margin: 2px 0 8px; }
.match-card .goals-mini { display: flex; flex-direction: column; gap: 4px; }
.match-card .goals-mini a { font-size: 13px; color: var(--text2); }
.match-card .goals-mini a:hover { color: var(--accent2); }

/* ---------- Feed ---------- */
.feed-item { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.feed-item .txt { flex: 1; font-size: 14px; color: var(--text2); min-width: 0; }
.feed-item .txt b { color: var(--text); font-weight: 700; }
.feed-item .txt a { color: var(--accent2); }
.feed-item .when { font: 500 11px var(--mono); color: var(--text3); white-space: nowrap; }
.feed-item .txt.unseen { color: var(--text); font-weight: 600; }
.feed-item .txt.unseen::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--must); margin-left: 7px; vertical-align: middle; }
.feed-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; flex-shrink: 0; background: var(--glass); border: 1px solid var(--border); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text3); }
.empty .big { font-size: 40px; margin-bottom: 12px; }
.empty p { font-size: 14px; max-width: 340px; margin: 0 auto 16px; }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: var(--r-full); background: var(--bg3); overflow: hidden; }
.progress > div { height: 100%; background: var(--grad); border-radius: var(--r-full); transition: width .4s ease; }

/* ---------- Login ---------- */
.auth-page { min-height: 92vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(94vw, 420px); background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 32px 26px; text-align: center; }
.auth-card .logo { font-size: 34px; display: block; margin-bottom: 6px; }
.auth-card .sub { color: var(--text2); font-size: 14px; margin-bottom: 22px; }

/* ---------- Skeleton loading ---------- */
.skel { background: linear-gradient(90deg, var(--skel1) 25%, var(--skel2) 50%, var(--skel1) 75%); background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: var(--r-md); }
@keyframes skel { to { background-position: -200% 0; } }

/* ============================================================
   Kompas — agent AI (głos + tekst)
   ============================================================ */
.kompas-fab {
  position: fixed; z-index: 55;
  right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 30px var(--accent-glow), 0 2px 8px rgba(0,0,0,.3);
  display: grid; place-items: center;
  transition: transform .2s, opacity .2s;
  animation: kompas-breathe 3.5s ease-in-out infinite;
}
.kompas-fab:hover { transform: scale(1.07); }
.kompas-fab.hidden { transform: scale(0); opacity: 0; pointer-events: none; }
.kompas-fab-ico { font-size: 26px; animation: kompas-spin 12s linear infinite; }
@keyframes kompas-breathe { 0%,100%{box-shadow:0 8px 30px var(--accent-glow),0 2px 8px rgba(0,0,0,.3);} 50%{box-shadow:0 8px 44px var(--accent-glow),0 2px 8px rgba(0,0,0,.3);} }
@keyframes kompas-spin { to { transform: rotate(360deg); } }

.kompas-panel {
  position: fixed; z-index: 56;
  right: 14px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  width: min(94vw, 400px); height: min(72vh, 620px);
  display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r-xl); overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(.96); opacity: 0;
  transition: transform .24s cubic-bezier(.2,.8,.2,1), opacity .24s;
  transform-origin: bottom right;
}
.kompas-panel.show { transform: translateY(0) scale(1); opacity: 1; }
.kompas-panel[hidden] { display: none; }
.kompas-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(99,102,241,.14), rgba(168,85,247,.08));
}
.kompas-id { display: flex; align-items: center; gap: 11px; }
.kompas-orb {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad);
  box-shadow: 0 0 16px var(--accent-glow); flex-shrink: 0;
  animation: kompas-breathe 3s ease-in-out infinite;
}
.kompas-name { font-weight: 800; font-size: 15px; }
.kompas-sub { font: 500 11px var(--mono); color: var(--text2); }
.kompas-head-btns { display: flex; gap: 4px; }
.kompas-icobtn { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 15px; color: var(--text2); transition: background .15s; }
.kompas-icobtn:hover { background: var(--glass); color: var(--text); }

.kompas-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.kompas-msg { max-width: 88%; padding: 10px 13px; border-radius: 15px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.kompas-msg.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 5px; }
.kompas-msg.ai { align-self: flex-start; background: var(--glass); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.kompas-dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.kompas-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text2); animation: kompas-dot 1.2s infinite; }
.kompas-dots i:nth-child(2){animation-delay:.2s} .kompas-dots i:nth-child(3){animation-delay:.4s}
@keyframes kompas-dot { 0%,60%,100%{opacity:.3;transform:translateY(0)} 30%{opacity:1;transform:translateY(-4px)} }

.kompas-sugs { display: flex; flex-wrap: wrap; gap: 7px; align-self: flex-start; max-width: 100%; }
.kompas-sug { padding: 7px 13px; border-radius: var(--r-full); font-size: 13px; font-weight: 600; color: var(--accent2); background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.32); transition: background .15s; }
.kompas-sug:hover { background: rgba(99,102,241,.2); }
.kompas-sug:disabled { opacity: .7; }
.kompas-action { align-self: flex-start; padding: 8px 15px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 700; color: #fff; background: var(--grad); box-shadow: 0 4px 16px var(--accent-glow); }

.kompas-listening { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--border); background: rgba(99,102,241,.06); }
.kompas-wave { display: flex; align-items: center; gap: 3px; height: 22px; }
.kompas-wave i { width: 3px; height: 100%; border-radius: 3px; background: var(--accent2); animation: kompas-wave 1s ease-in-out infinite; }
.kompas-wave i:nth-child(1){animation-delay:0s} .kompas-wave i:nth-child(2){animation-delay:.1s} .kompas-wave i:nth-child(3){animation-delay:.2s} .kompas-wave i:nth-child(4){animation-delay:.3s} .kompas-wave i:nth-child(5){animation-delay:.2s} .kompas-wave i:nth-child(6){animation-delay:.1s} .kompas-wave i:nth-child(7){animation-delay:0s}
@keyframes kompas-wave { 0%,100%{transform:scaleY(.3)} 50%{transform:scaleY(1)} }
.kompas-hear { font: 600 12px var(--mono); color: var(--accent2); }

.kompas-form { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.kompas-mic { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 18px; border: 1px solid var(--border); background: var(--glass); transition: all .15s; }
.kompas-mic:hover { border-color: var(--border2); }
.kompas-mic.on { background: var(--must); border-color: var(--must); animation: kompas-pulse 1.2s infinite; }
@keyframes kompas-pulse { 0%,100%{box-shadow:0 0 0 0 rgba(249,115,22,.5)} 50%{box-shadow:0 0 0 8px rgba(249,115,22,0)} }
.kompas-input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: var(--r-full); background: var(--bg3); border: 1px solid var(--border); font-size: 14px; outline: none; }
.kompas-input:focus { border-color: var(--accent); }
.kompas-send { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 16px; color: #fff; background: var(--grad); }

/* ---------- Desktop ---------- */
@media (min-width: 861px) {
  .kompas-fab { right: 28px; bottom: 28px; }
  .kompas-panel { right: 28px; bottom: 28px; }
  body { padding-bottom: 40px; }
  .bottom-nav { display: none; }
  .hdr-nav { display: flex !important; gap: 4px; }
  .hdr-nav a {
    padding: 8px 14px; border-radius: var(--r-md); font-weight: 600; font-size: 13.5px;
    color: var(--text2); transition: color .15s, background .15s;
  }
  .hdr-nav a:hover { color: var(--text); background: var(--glass); }
  .hdr-nav a.active { color: var(--accent2); background: rgba(99,102,241,.1); }
  .sheet-backdrop { place-items: center; }
  .sheet { border-radius: var(--r-xl); border-bottom: 1px solid var(--border2); }
}
@media (max-width: 860px) {
  .hdr-nav { display: none !important; }
}
