/* Компоненти върху legacy стиловете: touch цели, повърхности, листове,
   фокус и мобилни поправки на наследените класове. */

.touch-target { min-width: var(--touch); min-height: var(--touch); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text);
  font-size: 19px; border-radius: 10px; cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); }

.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* Модалите стават action sheet на телефон: плъзгат отдолу, вместват се в 100dvh */
.action-sheet { max-height: min(86dvh, 860px); }
@media (max-width: 599px) {
  .modal-overlay { align-items: flex-end; }
  .modal.action-sheet {
    width: 100%; max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(18px + var(--safe-bottom));
  }
}

/* фокус — видим и последователен */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* бутоните стават докосваеми */
.btn { min-height: var(--touch); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-sm { min-height: 34px; }

/* капчици/чипове — достатъчна цел на телефон */
.chip { min-height: 32px; display: inline-flex; align-items: center; }

/* toast долу-центрирано на телефон, над навигацията */
@media (max-width: 599px) {
  .toast { left: 12px; right: 12px; bottom: calc(var(--nav-height) + 12px); text-align: center; }
}

/* потоци/таблици в карти никога не разпъват страницата */
.card, .surface, .md { min-width: 0; overflow-wrap: break-word; }
.md table { display: block; overflow-x: auto; }
.md pre { overflow-x: auto; }

/* агент екранът: диалогов стълб */
.agent-screen { display: flex; flex-direction: column; min-height: calc(100dvh - var(--header-height) - var(--nav-height) - 36px); }
.agent-visual { height: clamp(160px, 26dvh, 300px); border-radius: var(--radius); overflow: hidden; position: relative; border: 1px solid var(--border); background: radial-gradient(ellipse 120% 90% at 50% 0%, #171a21 0%, #101216 55%, #0b0c10 100%); }
.agent-transcript { flex: 1; overflow-y: auto; padding: 14px 2px; min-height: 120px; }
.agent-interim { color: var(--muted); font-style: italic; }
.agent-controls { display: flex; gap: 8px; align-items: center; padding-top: 8px; flex-wrap: wrap; }
.voice-btn {
  flex: 1; min-height: 54px; border-radius: 14px; font-size: 16px; font-weight: 600;
  background: var(--accent); color: #16181d; border: none; cursor: pointer;
}
.voice-btn[data-state="listening"] { background: var(--c-ok); }
.voice-btn[data-state="error"] { background: var(--c-danger); }
.voice-btn:disabled { opacity: .6; }

.citation-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.citation-chip {
  font-size: 11.5px; padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--border); color: var(--muted); background: var(--panel);
}

/* карта на чакащо действие */
.action-card {
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(212, 169, 78, .08), transparent);
  padding: 14px 16px; margin: 10px 0;
}
.action-card .risk { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.action-card .risk.irreversible { color: var(--c-danger); }
.action-card .desc { margin: 8px 0; font-size: 15px; }
.action-card .hint { color: var(--muted); font-size: 12.5px; }
.action-card .modal-actions { margin-top: 12px; }

/* списъци с обекти на телефон */
.list-line { flex-wrap: wrap; }
.list-line .suggest { margin-left: 0; width: 100%; text-align: left; }
@media (min-width: 600px) {
  .list-line .suggest { margin-left: auto; width: auto; text-align: right; }
}

/* форми извън модали */
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  font-size: 16px; /* предотвратява iOS zoom */
}

/* mind flow на телефон: инспекторът е bottom sheet */
@media (max-width: 899px) {
  #flow-wrap { flex-direction: column; height: auto; }
  #flow-canvas-box { height: min(62dvh, 520px); }
  #flow-inspector { width: auto; max-height: 40dvh; }
}
