/* ==========================================================================
   Irizar ieBus AI – konsola rozmowy
   ========================================================================== */

.console {
  position: relative;
  display: grid;
  /* minmax(0, …) – treść (np. pole tekstowe) nie może rozepchnąć konsoli poza ekran */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
  border-radius: var(--r-shell);
  background:
    linear-gradient(180deg, rgba(var(--ion-rgb), 0.06), transparent 30%),
    var(--glass);
  box-shadow: var(--shadow-deep), var(--inner-edge);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  overflow: hidden;
  isolation: isolate;
}

/* Holograficzna krawędź – obracający się gradient widoczny tylko w obramowaniu */
.console::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(from var(--edge-angle, 0deg), transparent 0 55%, rgba(var(--ion-rgb), 0.75) 70%, rgba(var(--nebula-rgb), 0.6) 80%, transparent 92%);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  animation: edge-spin 9s linear infinite;
  pointer-events: none;
}

@property --edge-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes edge-spin {
  to { --edge-angle: 360deg; }
}

[data-state='thinking'] .console::before {
  animation-duration: 2.4s;
}

.console__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.console__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-2);
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.console__sub {
  color: var(--mist);
  font-size: var(--step--1);
}

.console__body {
  position: relative;
  min-height: 0;
}

/* --------------------------------------------------------------------------
   Avatary
   -------------------------------------------------------------------------- */

.avatar {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
}

.avatar svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.avatar--sm { width: 36px; height: 36px; }
.avatar--md { width: 44px; height: 44px; }
.avatar--lg { width: 56px; height: 56px; }
.avatar--xl { width: 88px; height: 88px; }

.avatar--ai svg {
  stroke: var(--ion);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.avatar--ai .avatar__ring {
  stroke: rgba(var(--ion-rgb), 0.35);
  fill: rgba(6, 16, 34, 0.9);
}

.avatar--ai .avatar__orbit {
  stroke: var(--frost);
  stroke-width: 1.8;
  stroke-dasharray: 18 82;
  transform-origin: 24px 24px;
  animation: spin 9s linear infinite;
}

.avatar--ai .avatar__glass {
  fill: rgba(var(--ion-rgb), 0.22);
}

.avatar__halo {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--ion-rgb), 0.35), transparent 65%);
  opacity: 0.5;
  transition: opacity var(--t-med);
}

.avatar--user svg {
  stroke: var(--mist);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.avatar--user .avatar__ring {
  stroke: rgba(var(--nebula-rgb), 0.45);
  fill: rgba(var(--nebula-rgb), 0.12);
}

/* Stany avatara */
[data-state='thinking'] .avatar--ai .avatar__orbit {
  animation-duration: 1.1s;
  stroke-dasharray: 34 66;
}

[data-state='thinking'] .avatar__halo,
[data-state='speaking'] .avatar__halo {
  opacity: 1;
}

[data-state='speaking'] .avatar__halo {
  animation: halo-pulse 1.1s var(--ease-in-out) infinite;
}

[data-state='listening'] .avatar--ai svg {
  stroke: var(--ok);
}

[data-state='listening'] .avatar__halo {
  opacity: 1;
  background: radial-gradient(circle, rgba(99, 242, 191, 0.4), transparent 65%);
  animation: halo-pulse 1.4s var(--ease-in-out) infinite;
}

[data-state='offline'] .avatar--ai svg {
  stroke: var(--dim);
}

[data-state='offline'] .avatar__orbit {
  animation: none;
}

@keyframes halo-pulse {
  50% { transform: scale(1.25); opacity: 0.55; }
}

/* --------------------------------------------------------------------------
   Przebieg rozmowy
   -------------------------------------------------------------------------- */

.log {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--ion-rgb), 0.3) transparent;
  mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 calc(100% - 12px), transparent 100%);
}

.log:focus-visible {
  outline-offset: -3px;
}

.intro {
  display: grid;
  gap: 18px;
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  max-width: 100%;
  animation: msg-in 520ms var(--ease-out) both;
}

.msg--user {
  justify-content: flex-end;
  padding-left: 12%;
}

.msg--bot {
  padding-right: 6%;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
    filter: blur(4px);
  }
}

.msg__content {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.msg--user .msg__content {
  justify-items: end;
}

.bubble {
  position: relative;
  max-width: 64ch;
  padding: 14px 18px;
  border-radius: var(--r-bubble);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.bubble--bot {
  border-bottom-left-radius: 6px;
  background:
    linear-gradient(135deg, rgba(var(--ion-rgb), 0.1), rgba(var(--nebula-rgb), 0.05) 60%, transparent),
    rgba(10, 22, 44, 0.7);
  box-shadow: inset 0 0 0 1px rgba(var(--ion-rgb), 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.bubble--user {
  border-bottom-right-radius: 6px;
  color: var(--polar);
  background: linear-gradient(135deg, rgba(var(--nebula-rgb), 0.42), rgba(var(--ion-rgb), 0.22));
  box-shadow: inset 0 0 0 1px rgba(var(--nebula-rgb), 0.45), 0 10px 30px -12px rgba(var(--nebula-rgb), 0.6);
}

/* Treść markdown */
.bubble p + p,
.bubble p + ul,
.bubble p + ol,
.bubble ul + p,
.bubble ol + p,
.bubble .md-table + p,
.bubble p + .md-table {
  margin-top: 0.7em;
}

.bubble strong {
  color: #ffffff;
  font-weight: 700;
}

.bubble em {
  color: var(--frost);
}

.bubble ul,
.bubble ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.bubble ul li,
.bubble ol li {
  position: relative;
  padding-left: 22px;
}

.bubble ul li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0.68em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--ion);
  box-shadow: 0 0 8px rgba(var(--ion-rgb), 0.8);
}

.bubble ol {
  counter-reset: item;
}

.bubble ol li {
  counter-increment: item;
}

.bubble ol li::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 0.18em;
  color: var(--ion);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}

.bubble .md-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  color: #ffffff;
}

.bubble code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(var(--ion-rgb), 0.12);
  font-size: 0.9em;
}

.bubble a,
.bubble .md-link {
  color: var(--ion);
  text-decoration: underline;
  text-decoration-color: rgba(var(--ion-rgb), 0.45);
  text-underline-offset: 3px;
}

.bubble a:hover {
  text-decoration-color: var(--ion);
}

.md-table {
  overflow-x: auto;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.md-table table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.md-table th,
.md-table td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.md-table th {
  color: var(--mist);
  font-weight: 600;
  font-size: var(--step--1);
  background: rgba(var(--ion-rgb), 0.06);
}

.md-table tr:last-child td {
  border-bottom: 0;
}

/* Przypisy */
.cite {
  display: inline-grid;
  place-items: center;
  min-width: 1.35em;
  height: 1.35em;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 6px;
  background: rgba(var(--ion-rgb), 0.14);
  color: var(--ion);
  font-family: var(--font-display);
  font-size: 0.66em;
  font-weight: 600;
  line-height: 1;
  vertical-align: 0.45em;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding-left: 4px;
}

.sources__label {
  color: var(--dim);
  font-size: var(--step--2);
  font-weight: 600;
}

.sources__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px 0 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--mist);
  font-size: var(--step--2);
  font-weight: 600;
  text-decoration: none;
}

a.source:hover {
  color: var(--polar);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.source__n {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(var(--ion-rgb), 0.14);
  color: var(--ion);
  font-family: var(--font-display);
}

.source .icon {
  color: var(--dim);
}

.source__label {
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg__image {
  max-width: min(100%, 420px);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* --------------------------------------------------------------------------
   Szybkie akcje
   -------------------------------------------------------------------------- */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-left: 48px;
}

.quick-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 2px;
  align-items: center;
  align-content: center;
  padding: 16px 18px;
  border: 0;
  border-radius: var(--r-card);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  overflow: hidden;
  transition: background-color var(--t-med), box-shadow var(--t-med), transform var(--t-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.quick-card:hover {
  background: rgba(var(--ion-rgb), 0.07);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 18px 40px -22px rgba(var(--ion-rgb), 0.6);
}

.quick-card:active {
  transform: scale(0.98);
}

.quick-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.quick-card__icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: var(--ion);
  background: radial-gradient(circle at 30% 20%, rgba(var(--ion-rgb), 0.28), rgba(var(--nebula-rgb), 0.08) 70%);
  box-shadow: inset 0 0 0 1px rgba(var(--ion-rgb), 0.25);
}

.quick-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-0);
  color: var(--polar);
  line-height: 1.25;
}

.quick-card__text {
  color: var(--mist);
  font-size: var(--step--1);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Oczekiwanie na odpowiedź
   -------------------------------------------------------------------------- */

.bubble--thinking {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
}

.wave {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
}

.wave i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--frost), var(--ion) 50%, var(--nebula));
  box-shadow: 0 0 8px rgba(var(--ion-rgb), 0.7);
  transform-origin: center;
  animation: wave 1.1s var(--ease-in-out) infinite;
}

.wave i:nth-child(2) { animation-delay: 0.12s; }
.wave i:nth-child(3) { animation-delay: 0.24s; }
.wave i:nth-child(4) { animation-delay: 0.36s; }
.wave i:nth-child(5) { animation-delay: 0.48s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.25); opacity: 0.6; }
  50% { transform: scaleY(1); opacity: 1; }
}

.thinking__text {
  color: var(--mist);
  font-size: var(--step--1);
  font-weight: 600;
  background: linear-gradient(90deg, var(--mist) 0%, var(--polar) 40%, var(--mist) 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.4s linear infinite;
}

.thinking__text::after {
  content: '…';
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* --------------------------------------------------------------------------
   Komunikaty systemowe
   -------------------------------------------------------------------------- */

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-left: 48px;
  padding: 12px 16px;
  border-radius: var(--r-control);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--mist);
  font-size: var(--step--1);
  animation: msg-in 400ms var(--ease-out) both;
}

.notice p {
  flex: 1 1 220px;
}

.notice .icon {
  flex: none;
  color: var(--ion);
}

.notice--error .icon {
  color: var(--danger);
}

.notice--error {
  box-shadow: inset 0 0 0 1px rgba(255, 138, 154, 0.35);
}

/* --------------------------------------------------------------------------
   Ekran łączenia
   -------------------------------------------------------------------------- */

.boot {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 42%, rgba(var(--ion-rgb), 0.1), transparent 55%), rgba(4, 10, 22, 0.94);
  transition: opacity 500ms var(--ease-out), filter 500ms;
}

.boot.is-leaving {
  opacity: 0;
  filter: blur(6px);
  pointer-events: none;
}

.boot__core {
  position: relative;
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
}

.boot__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(var(--ion-rgb), 0.25);
  border-top-color: var(--ion);
  box-shadow: 0 0 40px rgba(var(--ion-rgb), 0.15) inset;
  animation: spin 1.8s linear infinite;
}

.boot__ring--2 {
  inset: 18px;
  border-color: rgba(var(--nebula-rgb), 0.2);
  border-bottom-color: var(--nebula);
  animation-duration: 2.6s;
  animation-direction: reverse;
}

.boot__text {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-1);
  color: var(--polar);
  min-height: 1.6em;
}

.boot__bar {
  position: relative;
  width: min(260px, 70vw);
  height: 2px;
  border-radius: 2px;
  background: rgba(var(--ion-rgb), 0.15);
  overflow: hidden;
}

.boot__bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--ion), transparent);
  animation: bar 1.4s var(--ease-in-out) infinite;
}

@keyframes bar {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

.boot.is-error .boot__ring {
  animation: none;
  border-top-color: var(--danger);
}

.boot.is-error .boot__bar {
  display: none;
}

.boot__error {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.boot__error-title {
  font-weight: 700;
}

.boot__error-text {
  color: var(--mist);
  font-size: var(--step--1);
  margin-bottom: 10px;
}

/* --------------------------------------------------------------------------
   Propozycje pytań
   -------------------------------------------------------------------------- */

.suggestions {
  display: flex;
  gap: 8px;
  padding: 4px 22px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.suggestions::-webkit-scrollbar {
  display: none;
}

.suggestion {
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(var(--ion-rgb), 0.06);
  box-shadow: inset 0 0 0 1px rgba(var(--ion-rgb), 0.24);
  color: var(--frost);
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
  animation: msg-in 420ms var(--ease-out) both;
  transition: background-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast) var(--ease-out);
}

.suggestion--cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--on-ion);
  background: linear-gradient(120deg, var(--frost), var(--ion) 55%, var(--nebula));
  box-shadow: 0 8px 24px -10px rgba(var(--ion-rgb), 0.9);
}

.suggestion--cta:hover {
  background: linear-gradient(120deg, #ffffff, var(--ion) 55%, var(--nebula));
  box-shadow: 0 10px 28px -8px rgba(var(--ion-rgb), 1);
}

.suggestion:nth-child(2) { animation-delay: 60ms; }
.suggestion:nth-child(3) { animation-delay: 120ms; }

.suggestion:hover {
  background: rgba(var(--ion-rgb), 0.14);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.suggestion:active {
  transform: scale(0.97);
}

.suggestion:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* --------------------------------------------------------------------------
   Pole pytania
   -------------------------------------------------------------------------- */

.composer {
  display: grid;
  gap: 8px;
  padding: 0 18px 16px;
}

.composer__field {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 20px;
  border-radius: 26px;
  background: rgba(3, 9, 20, 0.7);
  box-shadow: inset 0 0 0 1px var(--line), 0 0 0 0 rgba(var(--ion-rgb), 0);
  transition: box-shadow var(--t-med) var(--ease-out);
}

.composer__field:focus-within {
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 4px rgba(var(--ion-rgb), 0.12), 0 0 40px -6px rgba(var(--ion-rgb), 0.45);
}

.composer.is-listening .composer__field {
  box-shadow: inset 0 0 0 1px rgba(99, 242, 191, 0.6), 0 0 0 4px rgba(99, 242, 191, 0.12), 0 0 40px -6px rgba(99, 242, 191, 0.5);
}

.composer__input {
  flex: 1;
  /* textarea ma domyślnie szerokość ~20 znaków – przy powiększonym tekście w telefonie wypychała przyciski */
  min-width: 0;
  width: 100%;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--polar);
  font-size: var(--step-0);
  line-height: 1.5;
  resize: none;
  outline: none;
}

.composer__input::placeholder {
  color: var(--dim);
}

.composer__btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast), box-shadow var(--t-med), opacity var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.composer__btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.composer__btn:active:not(:disabled) {
  transform: scale(0.92);
}

.composer__btn--mic {
  color: var(--mist);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line);
}

.composer__btn--mic:hover {
  color: var(--polar);
}

.composer__btn--mic[aria-pressed='true'] {
  color: var(--on-ion);
  background: var(--ok);
  box-shadow: 0 0 0 6px rgba(99, 242, 191, 0.18), 0 0 24px rgba(99, 242, 191, 0.7);
  animation: mic-pulse 1.3s var(--ease-in-out) infinite;
}

@keyframes mic-pulse {
  50% { box-shadow: 0 0 0 12px rgba(99, 242, 191, 0.08), 0 0 34px rgba(99, 242, 191, 0.8); }
}

.composer__btn--send {
  color: var(--on-ion);
  background: linear-gradient(135deg, var(--frost), var(--ion) 55%, var(--nebula));
  box-shadow: 0 8px 26px -8px rgba(var(--ion-rgb), 0.9);
}

.composer__btn--send:disabled {
  cursor: default;
  opacity: 0.35;
  box-shadow: none;
}

.composer__note {
  padding: 0 8px;
  color: var(--dim);
  font-size: var(--step--2);
  line-height: 1.45;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Karty (Adaptive / Hero) w stylu aplikacji
   -------------------------------------------------------------------------- */

.ac-card {
  display: grid;
  gap: 10px;
  max-width: 64ch;
  padding: 18px;
  border-radius: var(--r-card);
  background: rgba(10, 22, 44, 0.7);
  box-shadow: inset 0 0 0 1px rgba(var(--ion-rgb), 0.18);
}

.ac-card.is-submitted {
  opacity: 0.75;
}

.ac-text { line-height: 1.5; }
.ac-size-small { font-size: var(--step--1); }
.ac-size-medium { font-size: var(--step-1); }
.ac-size-large { font-size: var(--step-2); font-family: var(--font-display); font-weight: 400; }
.ac-size-extralarge { font-size: var(--step-3); font-family: var(--font-display); font-weight: 300; letter-spacing: -0.02em; }
.ac-bold { font-weight: 700; }
.ac-subtle { color: var(--mist); }
.ac-color-accent { color: var(--ion); }
.ac-color-good { color: var(--ok); }
.ac-color-warning { color: var(--warn); }
.ac-color-attention { color: var(--danger); }
.ac-align-center { text-align: center; }
.ac-align-right { text-align: right; }
.ac-space-none { margin-top: -8px; }
.ac-space-large, .ac-space-extralarge { margin-top: 8px; }
.ac-separator { padding-top: 10px; border-top: 1px solid var(--line); }

.ac-image { border-radius: 14px; }
.ac-image-small { width: 64px; }
.ac-image-medium { width: 140px; }
.ac-image-person { border-radius: 50%; }

.ac-container { display: grid; gap: 8px; }
.ac-style-emphasis, .ac-style-accent { padding: 12px; border-radius: 14px; background: rgba(var(--ion-rgb), 0.06); }

.ac-columns { display: flex; gap: 12px; flex-wrap: wrap; }
.ac-column { display: grid; gap: 8px; align-content: start; min-width: 0; }
.ac-column-stretch { flex: 1 1 0; }
.ac-column-auto { flex: 0 0 auto; }

.ac-facts { display: grid; gap: 6px; margin: 0; }
.ac-fact { display: grid; grid-template-columns: minmax(8ch, auto) 1fr; gap: 12px; }
.ac-fact dt { color: var(--mist); font-weight: 600; }
.ac-fact dd { margin: 0; }

.ac-field { display: grid; gap: 6px; }
.ac-label { color: var(--mist); font-size: var(--step--1); font-weight: 600; }
.ac-required { color: var(--danger); }

.ac-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: rgba(3, 9, 20, 0.7);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--polar);
}

.ac-input:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 3px rgba(var(--ion-rgb), 0.2);
}

.ac-input[aria-invalid='true'] {
  box-shadow: inset 0 0 0 1px var(--danger);
}

.ac-error { color: var(--danger); font-size: var(--step--1); }

.ac-choices { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.ac-choice { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.ac-choice input, .ac-toggle input { accent-color: var(--ion); width: 18px; height: 18px; }

.ac-toggle { display: flex; align-items: flex-start; gap: 12px; min-height: 40px; padding: 4px 0; cursor: pointer; }
.ac-toggle input { flex: none; margin-top: 3px; }
.ac-toggle__label { font-size: var(--step--1); line-height: 1.5; }

.ac-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.ac-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(var(--ion-rgb), 0.08);
  box-shadow: inset 0 0 0 1px rgba(var(--ion-rgb), 0.3);
  color: var(--frost);
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  transition: background-color var(--t-fast), transform var(--t-fast) var(--ease-out);
}

.ac-action:hover:not(:disabled) { background: rgba(var(--ion-rgb), 0.16); }
.ac-action:active:not(:disabled) { transform: scale(0.97); }
.ac-action:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ac-action:disabled { cursor: default; opacity: 0.5; }
.ac-action.is-chosen { opacity: 1; background: var(--ion); color: var(--on-ion); }
.ac-action--primary { background: var(--ion); color: var(--on-ion); }
.ac-showcard { display: grid; gap: 10px; }

/* --------------------------------------------------------------------------
   Responsywność konsoli
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .console {
    border-radius: 24px;
  }

  .console__head {
    padding: 12px 16px;
  }

  .console__head .avatar--lg {
    width: 44px;
    height: 44px;
  }

  .log {
    padding: 16px 14px 8px;
    gap: 14px;
  }

  .quick-grid {
    padding-left: 0;
  }

  .msg--user {
    padding-left: 8%;
  }

  .msg--bot {
    padding-right: 0;
  }

  .notice {
    margin-left: 0;
  }

  .suggestions {
    padding: 4px 14px 10px;
  }

  .composer {
    padding: 0 10px 10px;
  }
}

.intro__note {
  display: none;
  color: var(--dim);
  font-size: var(--step--2);
  line-height: 1.45;
}

@media (max-width: 600px), (max-height: 520px) {
  .console {
    grid-template-rows: minmax(0, 1fr) auto auto;
  }

  .console__head,
  .composer__note {
    display: none;
  }

  .intro__note {
    display: block;
  }
}

@media (max-width: 600px) {
  .quick-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .quick-card {
    padding: 12px 14px;
  }

  .quick-card__icon {
    width: 40px;
    height: 40px;
  }

  .msg .avatar--sm {
    width: 30px;
    height: 30px;
  }

  .msg--user .avatar {
    display: none;
  }

  .bubble {
    padding: 12px 15px;
  }

  .composer__note {
    font-size: 0.68rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .console::before,
  .avatar__orbit,
  .wave i,
  .thinking__text,
  .boot__ring,
  .boot__bar span {
    animation: none !important;
  }

  .wave i {
    transform: scaleY(0.6);
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .console {
    background: var(--glass-strong);
  }
}
