/* Final responsive guardrails shared by user, admin and public pages. */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; }
input, select, textarea, button { max-width: 100%; }

@media (max-width: 760px) {
  body { min-width: 0; }
  .main, .admin-main, #view, #adminView { min-width: 0; }
  .main { padding: 12px; }
  .topbar { margin: -12px -12px 14px; padding: 0 12px; }
  .top-account-trigger b { display: none; }
  .top-account-menu { right: 0; max-width: calc(100vw - 24px); }

  .card, .admin-panel, .site-settings-card, .log-panel, .schedule-page {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .grid, .metric-grid, .dashboard-layout, .dashboard-bottom,
  .settings-grid, .site-fields, .admin-form-grid, .admin-overview-grid,
  .bot-card-grid, .solution-grid { grid-template-columns: minmax(0, 1fr) !important; }

  .admin-page-head, .bots-head, .settings-title,
  .log-toolbar, .schedule-toolbar { align-items: stretch; flex-direction: column; }
  .admin-page-head > *, .bots-head > *, .log-toolbar > *, .schedule-toolbar > * { min-width: 0; }
  .admin-page-head button, .bots-head-actions button { width: 100%; justify-content: center; }

  .log-toolbar > div, .schedule-toolbar > div, .event-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    overflow: visible;
  }
  .log-toolbar select, .log-toolbar button,
  .schedule-toolbar select, .schedule-toolbar button,
  .event-tools select, .event-tools button { width: 100%; min-width: 0; }

  .table-wrap, .log-table-wrap, .schedule-table-wrap, .event-table-card,
  .admin-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { max-width: none; }

  .modal, .add-bot-modal, .schedule-editor-mask,
  .api-designer-mask, .variable-mask { padding: 0 !important; align-items: end; }
  .modal > .card, .add-bot-modal > .card, .schedule-editor, .api-designer,
  .api-variable-book {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94dvh !important;
    border-radius: 18px 18px 0 0 !important;
  }
  .modal > .card, .add-bot-modal > .card { overflow-y: auto; }
  .api-designer { height: 94dvh !important; }
  .designer-workspace { grid-template-columns: minmax(0, 1fr) !important; padding: 0 14px !important; }
  .designer-test { display: none; }
  .designer-grid, .variable-book-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .half-field, .reply-type-field { width: 100% !important; }
  .api-designer > header { min-height: 82px; padding: 16px; }
  .api-designer > header h2 { padding-right: 42px; font-size: 20px; }
  .designer-variable-all { right: 58px; bottom: 12px; font-size: 12px; }
  .designer-close { right: 14px; top: 13px; }
  .api-designer nav { gap: 22px; height: 52px; overflow-x: auto; }
  .api-designer nav button { min-width: max-content; font-size: 15px; }
  .designer-section { padding: 18px 15px; }
  .designer-section h3 { font-size: 17px; }
  .designer-section label, .designer-section input,
  .designer-section select, .designer-section textarea { font-size: 16px; }

  .logo-upload-row { grid-template-columns: 54px minmax(0, 1fr) !important; }
  .logo-upload-button { grid-column: 1 / -1; width: 100%; }
  .sticky-save { position: sticky; bottom: 0; z-index: 5; padding: 10px 0; background: rgba(245, 247, 251, .94); }
  .sticky-save button { width: 100%; }
}

@media (max-width: 600px) {
  .enterprise-hero { display: block !important; padding-right: 14px !important; padding-left: 14px !important; }
  .enterprise-hero-copy { margin-bottom: 30px; }
  .enterprise-console {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 14px;
    box-sizing: border-box;
  }
  .console-top { min-width: 0; padding: 0 10px; }
  .console-top > span { display: none; }
  .console-top small { min-width: 0; margin-left: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .console-top > b { flex: 0 0 auto; margin-left: 8px; }
  .console-body { display: block !important; min-width: 0; min-height: 0; }
  .blue-console-side, .console-body > aside { display: none !important; }
  .blue-console-main, .console-body > section { width: 100%; min-width: 0; padding: 14px 12px !important; box-sizing: border-box; }
  .blue-console-main > header, .console-heading { gap: 8px; }
  .blue-console-main > header h3, .console-heading h3 { font-size: 15px; }
  .blue-date, .console-heading > span { flex: 0 0 auto; font-size: 8px; }
  .blue-kpi, .console-metrics {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }
  .blue-kpi > div, .console-metrics > div { min-width: 0; padding: 10px; }
  .blue-kpi > div:nth-child(3), .console-metrics > div:nth-child(3) { grid-column: 1 / -1; }
  .blue-kpi small, .console-metrics small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .blue-activity { display: none; }
}

@media (max-width: 430px) {
  .main { padding: 10px; }
  .topbar { margin: -10px -10px 12px; }
  .admin-main { padding-right: 10px; padding-left: 10px; }
  .admin-main > header { margin-right: -10px; margin-left: -10px; }
  .admin-stat-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .bot-manage-card { padding: 14px; }
  .bot-card-top, .bot-identity { min-width: 0; }
  .bot-large-avatar { flex-basis: 46px; width: 46px; height: 46px; }
  .bot-name-line h2 { max-width: 52vw; }
  .auth-card, .admin-login-card { padding: 20px; }
  .enterprise-hero h1 { font-size: clamp(31px, 10vw, 40px); }
  .enterprise-actions a { width: 100%; box-sizing: border-box; text-align: center; }
}
