:root {
  color-scheme: light;
  --ink: #172d43;
  --muted: #526476;
  --line: #dbe3eb;
  --blue: #183b60;
  --bg: #f6f8fb;
  --accent: #dde8f5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.6 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  touch-action: manipulation;
}
a {
  color: var(--blue);
  text-underline-offset: 4px;
}
button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 550;
}
button:hover {
  background: #edf2f8;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #5688ba;
  outline-offset: 3px;
}
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  width: 100%;
  color: var(--ink);
  background: white;
}
textarea {
  resize: vertical;
  min-height: 96px;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #5688ba;
  outline-offset: 1px;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 650;
  margin: 12px 0 5px;
}
h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}
h1 {
  font-size: clamp(36px, 5vw, 54px);
  letter-spacing: -0.045em;
  line-height: 1.13;
  font-weight: 620;
  margin: 16px 0 20px;
}
h2 {
  font-size: 24px;
  line-height: 1.3;
}
h3 {
  font-size: 18px;
}
p {
  margin: 10px 0 20px;
}
.shell {
  max-width: 1080px;
  margin: auto;
  padding: 0 32px;
}
header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.04em;
}
.brandmark {
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--blue);
  color: white;
  width: 35px;
  height: 35px;
  font-size: 23px;
}
.header-actions {
  display: flex;
  gap: 8px;
}
.quiet {
  border-color: transparent;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
}
#chat-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 62px 0 20px;
}
.eyebrow {
  font-size: 14px;
  color: var(--muted);
}
.intro p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}
.mode {
  font-size: 14px;
  background: #e9eff6;
  color: #284767;
  border: 1px solid #d5e0ed;
  padding: 12px 16px;
  border-radius: 10px;
  margin: 28px 0 20px;
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.message {
  max-width: 100%;
  padding: 18px 22px;
  border-radius: 15px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.message.user {
  align-self: flex-end;
  background: var(--accent);
  max-width: 88%;
}
.message.assistant {
  background: white;
  border: 1px solid var(--line);
  width: 100%;
}
.message-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 9px;
  color: var(--muted);
  text-transform: uppercase;
}
.message-content {
  white-space: pre-wrap;
}
.message-content p {
  margin: 0 0 12px;
}
.message-content p:last-child {
  margin: 0;
}
.composer {
  background: white;
  border: 1px solid #bccbd9;
  border-radius: 17px;
  box-shadow: 0 8px 24px #122b4810;
  margin-top: 25px;
  overflow: hidden;
}
.composer textarea {
  border: 0;
  border-radius: 0;
  min-height: 118px;
  padding: 20px;
  background: transparent;
}
.composer textarea:focus {
  outline: 0;
}
.composer:focus-within {
  outline: 2px solid #5688ba;
}
.composer-bottom {
  padding: 0 13px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tools {
  display: flex;
  gap: 4px;
}
.tool {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  font-size: 14px;
  font-weight: 450;
  padding: 9px;
  color: var(--muted);
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.primary:hover {
  background: #244e79;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0;
  text-align: center;
}
.disclaimer {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin: 20px 0 10px;
}
footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  padding: 25px 0 30px;
  font-size: 13px;
}
footer a {
  color: var(--muted);
}
.files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file {
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  display: flex;
  align-items: center;
  gap: 12px;
}
.file span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.file small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.error {
  padding: 15px;
  background: #fff0ef;
  color: #8a2821;
  border: 1px solid #f0c7c3;
  border-radius: 10px;
  margin-top: 14px;
}
.danger {
  color: #9e2e27;
  border-color: #e0bdb9;
}
.muted {
  color: var(--muted);
  font-size: 14px;
}
.recording {
  background: #fff0ef;
  padding: 15px;
  border-radius: 12px;
  margin: 12px 0;
}
.panel {
  background: white;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 20px 0;
}
.inline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inline input {
  flex: 1;
  min-width: 0;
}
.inline button {
  flex-shrink: 0;
}
dialog {
  max-width: min(540px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 25px;
  color: var(--ink);
  box-shadow: 0 20px 100px #10203030;
}
dialog::backdrop {
  background: #10203066;
}
dialog button {
  margin: 8px 6px 0 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}
.article {
  max-width: 740px;
  margin: 45px auto;
  padding-bottom: 40px;
}
.article h1 {
  font-size: 36px;
}
.admin-shell {
  max-width: 1280px;
  margin: auto;
  padding: 0 28px;
}
.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 35px;
  margin: 32px 0;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-nav button {
  text-align: left;
  border: 0;
  background: transparent;
}
.admin-nav button.active {
  background: var(--accent);
  color: var(--blue);
}
.admin-content {
  min-width: 0;
}
.login {
  max-width: 460px;
  margin: 65px auto;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.metric {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.metric strong {
  display: block;
  font-size: 30px;
  font-weight: 550;
}
.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.cards {
  display: grid;
  gap: 12px;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.badge {
  display: inline-block;
  background: var(--accent);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
}
.card dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  margin: 16px 0;
}
.card dt {
  color: var(--muted);
  font-size: 14px;
}
.card dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.check-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  font-size: 14px;
}
.check-label input {
  width: 18px;
  margin-top: 5px;
  flex-shrink: 0;
}
.empty {
  border: 1px dashed #bccbd9;
  padding: 35px;
  text-align: center;
  border-radius: 12px;
  color: var(--muted);
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.small-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
@media (max-width: 650px) {
  .shell,
  .admin-shell {
    padding: 0 16px;
  }
  header {
    padding: 20px 0;
    align-items: flex-start;
  }
  .brand {
    font-size: 20px;
  }
  .brandmark {
    width: 30px;
    height: 30px;
  }
  .header-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
  }
  .quiet {
    padding: 5px 8px;
  }
  #chat-main {
    padding: 35px 0 12px;
  }
  .intro p {
    font-size: 16px;
  }
  .desktop {
    display: none;
  }
  .mode {
    margin: 22px 0 18px;
  }
  .tool span {
    display: none;
  }
  .composer-bottom {
    padding: 0 10px 10px;
  }
  .composer textarea {
    padding: 16px;
  }
  .composer-bottom button {
    padding: 10px 12px;
  }
  .message {
    padding: 16px;
  }
  .disclaimer {
    font-size: 13px;
  }
  footer {
    gap: 12px 18px;
    padding-top: 12px;
  }
  .admin-layout {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 20px;
  }
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .admin-nav button {
    font-size: 14px;
    padding: 8px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .filters {
    grid-template-columns: 1fr;
  }
  .card dl {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .card dd {
    margin-bottom: 8px;
  }
  .inline {
    flex-wrap: wrap;
  }
  .inline input {
    flex-basis: 100%;
  }
  .article {
    margin-top: 30px;
  }
  .recording button {
    font-size: 14px;
  }
}
#consent-panel label {
  display: block;
  margin: 14px 0;
  line-height: 1.6;
}
#consent-panel input {
  width: auto;
  margin-right: 8px;
}
#consent-panel a {
  text-decoration: underline;
}
footer {
  flex-wrap: wrap;
}
input[type="checkbox"] {
  width: auto;
  margin: 0 10px 0 0;
  vertical-align: middle;
}
dialog code {
  display: block;
  overflow-wrap: anywhere;
  padding: 16px;
  background: #eef3f8;
}
.economy-strip { display:flex; align-items:center; justify-content:flex-end; gap:12px; margin:12px 0; color:var(--muted); font-size:13px; }
.conversation-credit { display:flex; align-items:center; gap:9px; }
.credit-ring { --remaining:100%; display:grid; place-items:center; width:44px; height:44px; border-radius:50%; background:conic-gradient(#548575 var(--remaining),#e8eeeb 0); position:relative; isolation:isolate; font-size:12px; font-weight:700; color:#365e50; }
.credit-ring::before { content:""; position:absolute; inset:3px; border-radius:50%; background:#fff; z-index:-1; }
.credit-help { position:relative; }
.credit-help summary { display:grid; place-items:center; width:23px; height:23px; border:1px solid var(--line); border-radius:50%; cursor:pointer; list-style:none; }
.credit-help summary::-webkit-details-marker { display:none; }
.credit-help p { position:absolute; bottom:30px; right:0; width:min(290px,75vw); padding:16px; border:1px solid var(--line); border-radius:14px; background:#fff; box-shadow:0 8px 30px #172b3a15; z-index:5; line-height:1.6; }
.recording { display:flex; align-items:center; flex-wrap:wrap; gap:12px; background:#edf4f0; color:#365e50; border:1px solid #d5e4dc; }
.voice-wave { display:flex; align-items:center; justify-content:center; gap:3px; height:42px; min-width:126px; }
.voice-wave i { display:block; width:3px; height:4px; border-radius:4px; background:#548575; transition:height 65ms linear; }
.transcribing .voice-wave i { animation:voice-processing 1.2s ease-in-out infinite; }
.transcribing .voice-wave i:nth-child(3n) { animation-delay:.2s; }
.transcribing .voice-wave i:nth-child(3n + 1) { animation-delay:.4s; }
@keyframes voice-processing { 0%,100% { transform:scaleY(1); opacity:.4; } 50% { transform:scaleY(5); opacity:1; } }
@media(max-width:600px) { .economy-strip { justify-content:flex-start; flex-wrap:wrap; } .recording { gap:8px; } .voice-wave { flex:1; } }
@media(prefers-reduced-motion:reduce) { .transcribing .voice-wave i { animation:none; opacity:.6; } }
.channel-switch { display:flex; justify-content:center; flex-wrap:wrap; gap:10px; margin:16px 0 24px; }
.channel-button { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 16px; border-radius:22px; background:#fff; font-size:14px; min-height:44px; }
.channel-button::before { content:""; width:8px; height:8px; border-radius:50%; background:#2196c7; }
.channel-button.max::before { background:#7a5bdd; }
.payment-packages { display:flex; gap:10px; flex-wrap:wrap; margin:20px 0; }
.payment-packages button { flex:1; min-width:120px; background:#173d55; color:#fff; border-color:#173d55; }
.checkout-notice:empty { display:none; }
@media(max-width:600px) { .channel-switch { gap:8px; margin:12px 0 20px; } .channel-button { padding:10px 12px; font-size:13px; } .economy-strip > button { margin-left:auto; } input,textarea,select { font-size:16px; } }
#chat-main { padding-top:30px; }
.intro h1 { margin:12px 0 12px; font-size:clamp(32px,4.4vw,46px); }
.intro p { margin:0 0 18px; }
.composer { margin-top:12px; }
.consent-inline { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:5px; margin:12px 0 18px; color:var(--muted); font-size:13px; }
#consent-panel.consent-inline label { display:inline; margin:0; font-size:13px; line-height:1.5; font-weight:400; }
#consent-panel.consent-inline input { width:16px; height:16px; margin:0 4px 0 0; accent-color:#183b60; cursor:pointer; }
.terms-link { border:0; background:transparent; padding:0; border-radius:2px; color:var(--blue); text-decoration:underline; font-size:13px; font-weight:400; }
.terms-link:hover { background:transparent; }
.channel-switch { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:0 0 18px; }
.channel-button { border:0; min-height:48px; border-radius:12px; color:#fff; background:#2481cc; padding:11px 16px; font-weight:600; }
.channel-button::before { display:none; }
.channel-button.telegram { background:#229ed9; }
.channel-button.max { background:linear-gradient(115deg,#466bff,#824ef5); }
.channel-button.telegram:hover { background:#168bc4; }
.channel-button.max:hover { background:linear-gradient(115deg,#385bea,#7340e4); }
.channel-button svg,.channel-button img { width:24px; height:24px; flex-shrink:0; }
.channel-button img { background:#fff; border-radius:7px; padding:3px; width:28px; height:28px; }
.terms-dialog { width:min(540px,calc(100vw - 28px)); max-height:80dvh; overflow-y:auto; }
.terms-dialog-header { display:flex; justify-content:space-between; gap:12px; align-items:center; }
.terms-dialog-header h2 { margin:0; font-size:22px; }
.terms-dialog-header button { border:0; padding:4px 12px; font-size:26px; background:transparent; }
.terms-dialog>p { font-size:14px; color:var(--muted); margin:12px 0 18px; }
#terms-details details { border-top:1px solid var(--line); padding:12px 0; font-size:14px; }
#terms-details summary { cursor:pointer; font-weight:600; }
#terms-details h3 { font-size:16px; margin:18px 0 8px; }
#terms-details p { margin:8px 0 12px; }
@media(max-width:650px) { #chat-main { padding-top:20px; } .intro .eyebrow { font-size:12px; } .intro h1 { margin:10px 0; font-size:34px; } .intro p { font-size:15px; } .consent-inline { justify-content:flex-start; margin:10px 0 16px; } .channel-switch { gap:10px; } .channel-prefix { display:none; } .channel-button { font-size:15px; } }
.conversation-actions { justify-content:flex-end; flex-wrap:wrap; margin:18px 0 0; padding-top:12px; border-top:1px solid var(--line); }
@media(max-width:650px) { .conversation-actions { flex-direction:row; gap:8px; } }
