/* Mobile-first layout corrections. Loaded after page styles; no business rules. */
:root { --ty-header-height: 60px; }
*, *::before, *::after { box-sizing: border-box; }
body { overflow-wrap: anywhere; }
main, section, article, aside, form, fieldset { min-width: 0; }
img, video, svg, canvas { max-width: 100%; }
img, video, canvas { height: auto; }
iframe { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: calc(var(--ty-header-height) + 16px); }
.ty-table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.ty-table-scroll:focus-visible { outline-offset: -3px; }
.ry-breadcrumb, .ry-footer-bottom-links, .ry-blog-pagination { flex-wrap: wrap; }
.ry-nav-dropdown:focus-within .ry-nav-dropdown-menu { display: block; }
.ry-nav-inner { height: var(--ty-header-height); }
.ry-nav-links { gap: 16px; align-items: center; }
.ry-nav-hamburger { min-width: 44px; min-height: 44px; }
.ry-nav-mobile { position: absolute; inset: 100% 0 auto; max-height: calc(100dvh - var(--ty-header-height)); overflow-y: auto; overscroll-behavior: contain; }
.ry-nav-mobile a, .ry-nav-mobile button { min-height: 44px; }
.ry-footer-toggle { width: 100%; background: none; border: 0; text-align: left; font-family: inherit; }
.ty-help-dock { display: none; }
#chat-bubble-invite { display: none !important; } /* Help remains available without an intrusive invitation. */
#chat-toggle { width: 56px !important; height: 56px !important; }
#chat-messages, #chat-messages-full { min-height: 0; overflow-wrap: anywhere; overscroll-behavior: contain; }
#chat-input, #chat-input-full { min-width: 0; min-height: 44px !important; font-size: 16px !important; }
#chat-window > div:first-child > button, #chat-fullscreen > div:first-child > button,
#chat-fullscreen > div:last-child > button { min-width: 44px; min-height: 44px !important; flex-shrink: 0; }
#chat-window > div:first-child { gap: 6px !important; padding: 10px !important; }
#chat-window > div:first-child > div:nth-child(2) { min-width: 0; }
#chat-window { max-height: calc(100dvh - 100px); }
#chat-fullscreen { top: var(--ty-visual-top, 0px) !important; bottom: auto !important; height: var(--ty-visual-height, 100dvh); }
.ty-home { margin: 0 auto; padding: 24px 16px; }
.ty-home .ty-home-hero { padding: 8px 0 12px; }
.ty-home .ty-home-hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
.ty-home .ty-home-hero p { font-size: 1rem; margin: 12px 0; line-height: 1.55; }
.ty-home .ty-home-hero .ty-progress { font-size: .78rem; }
.ty-home section { margin-bottom: 32px; }
.ty-home h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); line-height: 1.25; }
.ty-home h3 { font-size: 1rem; line-height: 1.3; }
.ty-home-cards { grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 16px 0; }
.ty-home-cards > a, .ty-home-cards > article { padding: 16px; min-width: 0; }
.ty-home-cards p { margin: 6px 0 0; font-size: .95rem; line-height: 1.5; }
.ty-home #como-funciona { padding: 0; background: none; overflow: visible; }
.ty-home #como-funciona::before { content: none; }
.ty-home-steps article { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 2px 12px; align-content: center; }
.ty-home-steps b { grid-row: 1 / 3; color: #2563eb; font-size: 1.1rem; }
.ty-home details { padding: 12px 0; }
.ty-home summary { min-height: 44px; align-content: center; }
.ty-preview .ty-locked { padding: 6px 0; }
.ty-preview .ty-locked i { height: 8px; margin: 8px 0; }
.ty-preview .ty-paper p { margin: 8px 0; }
.ty-preview .ty-purchase ul { padding-left: 20px; }
.ty-preview .ty-purchase p { margin: 12px 0; }
.ty-preview .ty-paper, .ty-preview .ty-purchase { padding: 18px; }
.ty-preview-grid > * { min-width: 0; }
.blog-content img { max-width: 100%; height: auto; }
.blog-content pre { overflow: auto; max-width: 100%; white-space: pre-wrap; }
.ty-blog-layout { display: grid; grid-template-columns: minmax(0,1fr); gap: 24px; }
.ty-blog-layout > * { min-width: 0; }
.ty-blog-meta { flex-wrap: wrap; }
.ty-blog-image { aspect-ratio: 16 / 9; object-fit: cover; }
@media (max-width: 1199px) {
  .ry-nav-links, .ry-nav-actions { display: none; }
  .ry-nav-hamburger { display: flex; align-items: center; justify-content: center; }
}
@media (min-width: 1200px) {
  :root { --ty-header-height: 68px; }
  .ry-nav-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .ty-home { padding: 40px 24px; }
  .ty-home .ty-home-hero { padding: 16px 0 32px; }
  .ty-home-cards { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
  .ty-home-cards > a, .ty-home-cards > article { padding: 24px; }
  .ty-home-steps article { display: block; }
  .ty-home-steps h3 { margin-top: 12px; }
  .ty-home section { margin-bottom: 48px; }
}
@media (min-width: 960px) {
  .ty-blog-layout { grid-template-columns: minmax(0,1fr) 280px; gap: 32px; }
}
@media (max-width: 767px) {
  .ry-container, .ry-nav-inner { padding-inline: 16px; }
  .ry-btn { white-space: normal; text-align: center; min-height: 44px; }
  main input:not([type=checkbox]):not([type=radio]):not([type=hidden]), main select, main textarea {
    min-width: 0; max-width: 100%; min-height: 44px; font-size: 16px !important;
  }
  main textarea { resize: vertical; }
  main button { min-height: 44px; }
  .ty-stack-grid, .wz-grid-2 { grid-template-columns: minmax(0,1fr) !important; }
  .ty-stack-grid > * { min-width: 0; }
  .ty-mobile-page { min-height: 0 !important; padding: 24px 16px 32px !important; }
  .ty-mobile-card { padding: 20px 16px !important; }
  .login-grid, .reg-grid { min-height: 0 !important; }
  .login-form-panel, .reg-form-panel { padding: 28px 16px !important; }
  .ty-document-layout a[style*="min-width"] { min-width: 0 !important; }
  .ty-document-layout a[style*="inline-flex"] { flex-wrap: wrap; max-width: 100%; }
  .ty-funnel { margin: 0 auto; padding: 24px 16px; }
  .ty-funnel .ry-btn { width: 100%; }
  .ty-preview-grid { grid-template-columns: minmax(0,1fr); gap: 12px; margin-top: 16px; }
  .ty-preview .ty-paper, .ty-preview .ty-purchase { position: static; }
  .ty-preview .ty-paper h2 { font-size: 1.2rem; }
  .wz-progress { position: static; padding: 10px 12px; }
  .wz-steps-row { flex-wrap: wrap; }
  .wz-panel-header { padding: 12px; gap: 8px; flex-wrap: wrap; }
  .wz-panel-title { min-width: 100px; }
  .wz-panel-body { padding: 16px 12px; }
  .wz-panel-status { white-space: normal; }
  .wz-data-box { padding: 12px; }
  .ry-page-head { padding: 28px 0; }
  .ry-page-title { font-size: clamp(1.5rem, 6vw, 2rem); }
  .ry-page-head + .ry-container { padding: 24px 16px 32px !important; }
  .ry-cat-grid, .ry-docs-grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .ry-cat-card, .ry-doc-select { padding: 20px; min-height: 0; }
  .ry-cat-card-foot { flex-wrap: wrap; gap: 8px; }
  .ry-cat-card-examples { margin-block: 12px; }
  .ry-ai-helper { padding: 24px 20px; margin-top: 24px; }
  .ry-ai-helper-robot { max-height: 120px; }
  .ry-sofia-card-cat { padding: 16px !important; flex-wrap: wrap; }
  .ry-sofia-card-cat button { width: 100%; white-space: normal !important; }
  .ry-blog-hero { padding-top: 28px; }
  .ty-blog-container { padding-top: 24px !important; padding-bottom: 32px !important; }
  .ty-blog-layout aside { position: static !important; }
  .seo-hero { height: auto; min-height: 240px; }
  .seo-hero-content { padding: 32px 16px; }
  .seo-section, .ry-section { padding-block: 40px; }
  .pseo-hero { padding-block: 32px !important; }
  .pseo-hero h1 { font-size: clamp(1.65rem, 6vw, 2.2rem); }
  .pseo-btn { white-space: normal; height: auto; text-align: center; padding-block: 12px; }
  .ry-footer { padding: 24px 0 16px; }
  .ry-footer-grid { grid-template-columns: minmax(0,1fr); gap: 0 !important; margin-bottom: 12px; }
  .ry-footer-brand { max-width: 100%; margin-bottom: 14px; }
  .ry-footer-logo { margin-bottom: 8px; }
  .ry-footer-desc { margin-bottom: 10px; font-size: 14px; line-height: 1.5; }
  .ry-footer-col-secondary { border-bottom: 1px solid #ffffff20; }
  .ry-footer-col-secondary > h4 { display: none; }
  .ry-footer-toggle { display: flex !important; align-items: center; justify-content: space-between; min-height: 44px; padding: 10px 0; color: #fff; font-size: 13px; font-weight: 700; }
  .ry-footer-col-secondary .ry-footer-toggle-body { display: none; padding: 4px 0 12px; }
  .ry-footer-col-secondary.open .ry-footer-toggle-body { display: block; }
  .ry-footer-links { gap: 0; }
  .ry-footer-links a { min-height: 44px; align-content: center; }
  .ry-footer-bottom { flex-direction: column; align-items: stretch; gap: 8px; font-size: 12px; line-height: 1.5; }
  .ry-footer-bottom-links { gap: 4px 16px; justify-content: center; }
  .ry-footer-bottom-links a { min-height: 44px; align-content: center; }
  /* Reserve an actual help row: the launcher cannot float over any mobile CTA. */
  .ty-help-dock { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 16px; min-height: 80px; background: #f0f6ff; color: #17304e; }
  #chatbot-widget { position: static !important; }
  #chat-window, #chat-window.expanded {
    position: fixed !important; inset: var(--ty-visual-top, 0px) 0 auto !important;
    width: 100% !important; height: var(--ty-visual-height, 100dvh) !important;
    max-height: var(--ty-visual-height, 100dvh) !important; border-radius: 0 !important;
    z-index: 9999; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  }
  #chat-window > div:first-child > div:first-child { display: none; } /* Decorative avatar only. */
  #chat-window > div:last-child { padding: 10px !important; }
  #chat-fullscreen > div:first-child > button { flex-basis: 44px !important; }
  #chat-fullscreen > div:last-child > button { flex-basis: 44px !important; }
  #chat-messages { padding: 12px !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
.ty-admin #panel-main { min-width: 0; }
.ty-admin #panel-main > div:first-child { flex-wrap: wrap; gap: 8px; }
.ty-admin #panel-sidebar { overflow-y: auto; max-height: 100dvh; }
.ty-admin #sidebar-toggle { min-width: 44px; }
@media (max-width: 767px) {
  .ty-admin #panel-main { margin-left: 0 !important; width: 100%; }
  .ty-admin #panel-main > .p-6 { padding: 20px 16px; }
  .ty-admin #panel-main > div:first-child { padding-left: 56px; position: static; }
  .ty-admin #sidebar-toggle { top: 8px; transform: none; height: 44px; }
  .ty-admin .card-admin { padding: 16px; }
  .ty-admin .section-header { overflow-wrap: anywhere; }
  .ty-admin input, .ty-admin select { width: 100%; }
  .ty-admin .grid { grid-template-columns: minmax(0,1fr); }
  .ty-admin .col-span-2, .ty-admin .col-span-3 { grid-column: auto; }
  .ry-blog-grid { grid-template-columns: minmax(0,1fr); }
  .ry-blog-list { padding-block: 32px; }
  .ty-document-layout .wz-progress { position: static; }
  .ty-document-layout .wz-panel-body { padding: 16px 12px; }
  .ty-document-layout .wz-panel-header { padding: 12px; flex-wrap: wrap; }
  body .login-form-panel, body .reg-form-panel { padding: 28px 16px !important; }
  .ry-doc-row { flex-wrap: wrap; }
  .ry-doc-row-info { flex-basis: 60%; }
  .ry-contact-grid { grid-template-columns: minmax(0,1fr) !important; }
}
@media (max-width: 767px) {
  .ty-preview .ty-paper p, .ty-preview .ty-purchase li { line-height: 1.5; }
  .ty-preview .ty-purchase h2 { font-size: 1.25rem; }
  .ty-preview .ty-price { font-size: 1.65rem; margin: 8px 0; }
  .ty-preview .ty-purchase ul { margin-block: 8px; }
}
@media (max-width: 767px) {
  .ty-document-layout .wz-steps-row { flex-wrap: wrap; overflow: visible; }
  .ry-doc-row-info .ry-badge { white-space: normal; max-width: 100%; }
}
@media (max-width: 767px) {
  #chat-window, #chat-window.expanded { transition: none !important; }
  .ry-doc-row-info h3 { white-space: normal; overflow: visible; }
}
.wz-step-chip { border: 0; font-family: inherit; }
@media (max-width: 767px) {
  .ty-document-layout .wz-step-chip { min-height: 44px; font-size: .75rem; }
}
@media (max-width: 767px) {
  .ry-ai-helper-glow, .ry-ai-helper-robot, .ry-ai-helper-pulse { animation: none !important; }
  #ry-loading-overlay { max-height: 100dvh; overflow-y: auto; justify-content: flex-start !important; padding-block: 24px !important; }
  #ry-loading-overlay > div { flex-shrink: 0; }
}
.ty-pdf-help { color: #475569; font-size: .875rem; margin-bottom: 12px; }
@media (max-width: 767px) {
  #tyPdfFrame embed { height: min(440px, 55dvh) !important; max-width: 100%; }
}
.ty-apm .grid-12 > * { min-width: 0; }
@media (max-width: 767px) {
  .ty-apm .servidor-inner { grid-template-columns: minmax(0,1fr); }
  .ty-apm .gauges-col { flex-direction: row; flex-wrap: wrap; }
  .ty-apm .gauge-item { flex: 1; min-width: 80px; }
  .ty-apm button, .ty-apm select, .ty-apm input { min-height: 44px; max-width: 100%; }
  .ty-apm select, .ty-apm input { font-size: 16px; }
  .ty-apm .disco-fila, .ty-apm .vol-fila { flex-wrap: wrap; }
  .ty-apm .disco-ruta { flex-basis: 100%; white-space: normal; }
  .ty-apm .toast { max-width: calc(100vw - 24px); }
}
/* Tablets and narrow desktops also need a reserved help area beside wide articles. */
@media (min-width: 768px) and (max-width: 1399px) {
  .ty-help-dock { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 24px; min-height: 80px; background: #f0f6ff; color: #17304e; }
  #chatbot-widget { position: static !important; }
  #chat-window { position: fixed !important; bottom: 16px !important; right: 16px !important; }
}
