/* Inter self-hosted (variable font; avoids sending visitor IPs to Google Fonts) */
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext.ad4eb06671be.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin.8e433c0592f7.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Libellula "Luminous Agency" design tokens and components.
   Source: libelula/luminous_agency/DESIGN.md. Mobile-first; desktop from 768px. */
:root {
  --canvas: #0b1b2b;
  --card: #112338;
  --overlay: #172e49;
  --primary: #8c76c4;
  --secondary: #fce941;
  --white: #ffffff;
  --text: #d4e4fa;
  --muted: #cbc4d1;
  --error: #ffb4ab;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --radius: 0.5rem;
  --radius-lg: 1rem;
  --gutter: 1rem;
  --margin: 1.25rem;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (min-width: 768px) {
  :root { --gutter: 1.5rem; --margin: 3rem; }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--canvas); color: var(--text); font: 400 16px/24px var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); }
h1, h2 { color: var(--white); letter-spacing: -0.02em; margin: 0 0 0.5rem; }
h1 { margin-bottom: 1rem; }
h1 { font-size: 32px; line-height: 40px; font-weight: 700; }
h2 { font-size: 24px; line-height: 32px; font-weight: 600; }
@media (min-width: 768px) { h1 { font-size: 48px; line-height: 56px; } }
.site-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 0.5rem 1.5rem; border-bottom: 1px solid var(--border);
  /* align with the content column of <main> (max-width 72rem + same side margin) */
  padding: 1rem max(var(--margin), calc((100vw - 72rem) / 2 + var(--margin)));
}
.brand { flex: 0 0 auto; color: var(--white); font-weight: 800; font-size: 20px; text-decoration: none; }
.brand span { color: var(--secondary); }
.site-nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { font: 600 14px/20px var(--font); color: var(--white); text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: var(--primary); }
.site-nav .btn { width: auto; }
main { flex: 1; width: 100%; max-width: 72rem; margin: 0 auto; padding: 2rem var(--margin) 4rem; }
.narrow { max-width: 28rem; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.5rem; margin-bottom: var(--gutter);
}
.field { margin-bottom: 1rem; }
.field label { display: block; font: 600 14px/20px var(--font); margin-bottom: 0.25rem; color: var(--white); }
.field .help { font-size: 14px; color: var(--muted); margin-top: 0.25rem; }
.field .errors, .errorlist { color: var(--error); font-size: 14px; list-style: none; padding: 0; margin: 0.25rem 0 0; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; min-height: 48px; padding: 12px 16px; color: var(--white);
  background: rgba(11, 27, 43, 0.6); border: 1px solid var(--border-strong);
  border-radius: var(--radius); font: 400 16px/24px var(--font);
}
input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, 0.4); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(140, 118, 196, 0.2);
}
input[type=checkbox] { accent-color: var(--secondary); width: 20px; height: 20px; margin-right: 0.5rem; vertical-align: middle; }
.check { display: flex; align-items: flex-start; gap: 0.25rem; margin-bottom: 1rem; }
.check label { font-weight: 400; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 12px 28px; border: 0; cursor: pointer; text-decoration: none;
  font: 700 16px/24px var(--font); border-radius: 9999px; width: 100%;
}
.btn-primary { background: var(--secondary); color: var(--canvas); }
.btn-primary:hover { transform: scale(1.02); box-shadow: 0 0 24px rgba(252, 233, 65, 0.3); }
.btn-ghost {
  background: transparent; color: var(--white); border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius); font-weight: 600;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: rgba(140, 118, 196, 0.08); }
@media (min-width: 768px) { .btn { width: auto; } .stack .btn { width: 100%; } }
.stack > * + * { margin-top: 0.75rem; }
.divider { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: 14px; margin: 1.5rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: 0.75rem 1rem; border-radius: var(--radius); background: var(--overlay); margin-bottom: 0.5rem; }
.messages li.error { border: 1px solid var(--error); color: var(--error); }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 9999px; font: 700 12px/16px var(--font);
  letter-spacing: 0.04em; text-transform: uppercase; background: rgba(140, 118, 196, 0.15); color: var(--primary);
}
.notice { font-size: 14px; color: var(--muted); }
.hero { padding: 2rem 0 1rem; }
.hero p { font-size: 18px; line-height: 28px; max-width: 40rem; }
.telegram-widget { display: flex; justify-content: center; min-height: 40px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); }
.link-card { display: block; text-decoration: none; color: var(--text); }
.link-card:hover { border-color: rgba(140, 118, 196, 0.4); transform: translateY(-4px); }
.btn-google {
  background: var(--white); color: #1f1f1f; border: 1px solid var(--white);
  border-radius: 9999px; font-weight: 600; gap: 0.75rem;
}
.btn-google:hover { background: #f2f2f2; color: #1f1f1f; }
.btn-google .g-logo { flex: 0 0 auto; }
.chat-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.chat-head h1 { margin: 0; overflow-wrap: anywhere; }
.presence-dot { display: inline-block; width: 0.625rem; height: 0.625rem; border-radius: 50%; margin-right: 0.4rem; background: #8a8f98; vertical-align: middle; }
.presence-dot.presence-online { background: #3ddc84; }
.presence-dot.presence-busy { background: #ff9f43; }
.presence-dot.presence-offline { background: #8a8f98; }
.presence-line { margin: 0; font-size: 0.875rem; color: var(--muted); }
.avatar { flex: 0 0 auto; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--white); font-weight: 700; font-size: 1.25rem; }
.messages-box { display: flex; flex-direction: column; gap: 0.375rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; height: min(60vh, 34rem); height: min(60dvh, 34rem); overflow-y: auto; margin-bottom: 0.75rem; scroll-behavior: smooth; }
.bubble { align-self: flex-start; max-width: 82%; padding: 0.5rem 0.875rem; border-radius: 1.125rem 1.125rem 1.125rem 0.25rem; background: var(--overlay); overflow-wrap: anywhere; line-height: 1.4; }
.bubble.mine { align-self: flex-end; border-radius: 1.125rem 1.125rem 0.25rem 1.125rem; background: rgba(140, 118, 196, 0.35); }
.bubble.system { align-self: center; max-width: 100%; text-align: center; background: transparent; color: var(--muted); font-size: 0.875rem; padding: 0.25rem 0.5rem; }
.bubble .who { font-weight: 700; color: var(--primary); font-size: 0.8125rem; }
.bubble.mine .who { color: var(--secondary); }
.bubble .time { display: block; text-align: right; font-size: 0.6875rem; color: var(--muted); margin-top: 0.125rem; }
.chat-form { display: flex; gap: 0.5rem; align-items: center; }
.chat-form input[type=text] { border-radius: 9999px; padding-left: 1.25rem; }
.chat-form .btn { width: auto; }
.send-btn { border-radius: 9999px; min-width: 3rem; }
.send-icon { display: none; }
@media (max-width: 480px) {
  .send-label { display: none; }
  .send-icon { display: inline; }
  .send-btn { width: 3rem; padding: 0; }
}
.btn-telegram { background: #54a9eb; color: #fff; border-radius: 9999px; }
.btn-telegram:hover { background: #4a9bdb; }
.chat-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chat-actions .btn { width: auto; }
/* allauth pages without their own card (reset password, email confirm, ...) */
main.allauth > h1, main.allauth > p, main.allauth > form, main.allauth > section { max-width: 28rem; margin-left: auto; margin-right: auto; }
main.allauth > form p { margin: 0 0 1rem; }
main.allauth > form label { display: block; font: 600 14px/20px var(--font); color: var(--white); margin-bottom: 0.25rem; }
main.allauth > form .btn { margin-top: 0.5rem; }

.wide { max-width: 48rem; margin: 0 auto; }
.wide > .btn { margin-top: 1rem; }
@media (min-width: 768px) { .wide > .btn { width: auto; } }
.hero .badge { margin-bottom: 0.75rem; }
.site-footer { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: center; padding: 1.5rem var(--margin); border-top: 1px solid var(--border); font-size: 14px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.legal h1 { margin-bottom: 0.5rem; }
.legal h2 { margin-top: 1.5rem; font-size: 20px; line-height: 28px; }
.legal ul { padding-left: 1.25rem; }
.draft-banner { background: rgba(252, 233, 65, 0.12); border: 1px solid var(--secondary); color: var(--secondary); border-radius: var(--radius); padding: 0.75rem 1rem; font-weight: 600; }
.legal-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 14px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 0.5rem; border-bottom: 1px solid var(--border); }
/* checkbox groups: legend on top, one option per row (labels wrap inside their own row) */
.check-group { border: 0; padding: 0; margin: 0 0 0.25rem; min-width: 0; }
.check-group legend { font: 600 14px/20px var(--font); color: var(--white); padding: 0; margin-bottom: 0.5rem; }
.check-group .check { margin-bottom: 0.5rem; }
.check-group .check label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; margin: 0; }
.check-group input[type=checkbox] { flex: 0 0 auto; margin: 0; }
.pager { display: flex; gap: 0.75rem; margin-top: 1rem; }
.pager .btn { width: auto; }

/* --- Android-style bottom navigation: on EVERY page for signed-in users --- */
.account-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.account-actions .btn, .account-actions form { width: auto; }
body.has-bottom-nav main { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
body.has-bottom-nav .site-footer { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex;
  background: rgba(23, 46, 73, 0.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1 1 0; min-height: 56px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; color: var(--muted); text-decoration: none;
  font: 600 12px/16px var(--font); -webkit-tap-highlight-color: transparent;
}
.bottom-nav a svg { padding: 4px 18px; box-sizing: content-box; border-radius: 9999px; transition: background 0.15s; }
.bottom-nav a.active { color: var(--white); }
.bottom-nav a.active svg { background: rgba(140, 118, 196, 0.35); color: var(--secondary); }
.bottom-nav .icon-wrap { position: relative; display: inline-flex; }
.nav-badge {
  position: absolute; top: 0; right: 8px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9999px; background: var(--secondary); color: var(--canvas);
  font: 700 11px/18px var(--font); text-align: center;
}
@media (min-width: 768px) {
  /* desktop: same bar, centred and narrower (there is no other navigation) */
  .bottom-nav { left: 50%; right: auto; width: min(30rem, 100%); transform: translateX(-50%);
    border: 1px solid var(--border); border-bottom: 0; border-radius: 16px 16px 0 0; }
}
.count-badge { display: inline-block; min-width: 22px; padding: 0 7px; margin-left: 0.4rem; border-radius: 9999px; background: var(--secondary); color: var(--canvas); font: 700 13px/22px var(--font); text-align: center; vertical-align: middle; }
.env-banner { background: var(--secondary); color: #1f1f1f; text-align: center; font: 700 13px/1 var(--font); padding: 0.5rem 1rem; }
