/* Meu Portal · 09 — agendamentos e formulários
   Pedidos (filtros, grupos, tabela), formulários do bot (AgendaAi do Bot) e AgendaAi standalone. */

/* Agendamentos */
.apt-filter-row { display: flex; align-items: center; gap: .75rem; margin: -.5rem 0 1rem; flex-wrap: wrap; }
.apt-filter-row select { border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: .4rem .75rem; font-size: .85rem; background: #fff; outline: none; }
.apt-toolbar { display: flex; align-items: center; gap: .75rem; justify-content: space-between; flex-wrap: wrap; margin: 0 0 1rem; }
.apt-group-toggle { padding: .45rem .9rem; font-size: .84rem; }
.apt-group-toggle.active { background: #0f766e; color: #fff; border-color: #0f766e; }
.apt-groups-panel {
  display: none;
  margin: 0 0 1rem;
  border: 1px solid #dce5e1;
  border-radius: 16px;
  padding: .85rem;
  background: linear-gradient(180deg, rgba(246, 251, 249, 0.96), rgba(255, 255, 255, 0.98));
}
.apt-groups-panel.open { display: block; }
.apt-groups-list { display: flex; flex-direction: column; gap: .7rem; }
.apt-group-tab {
  border: 1px solid #d8e1dd;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.apt-group-tab summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
  padding: .9rem 1rem;
}
.apt-group-tab summary::-webkit-details-marker { display: none; }
.apt-group-tab summary::after {
  content: "▼";
  font-size: .78rem;
  color: #607275;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.apt-group-tab[open] summary::after { transform: rotate(180deg); }
.apt-group-title-wrap { min-width: 0; }
.apt-group-title { font-size: .92rem; font-weight: 700; color: #163134; }
.apt-group-meta { margin-top: .15rem; font-size: .77rem; color: #617174; }
.apt-group-count {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .3rem .65rem;
  background: #eef6f3;
  color: #245057;
  border: 1px solid #d3eee6;
  font-size: .76rem;
  font-weight: 700;
  white-space: nowrap;
}
.apt-group-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid #e7eeea;
}
.apt-group-items { display: flex; flex-direction: column; gap: .55rem; margin-top: .8rem; }
.apt-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem .85rem;
  border-radius: 12px;
  background: #f8fbfa;
  border: 1px solid #e2ebe7;
  flex-wrap: wrap;
}
.apt-group-item-main { min-width: 0; flex: 1; }
.apt-group-item-preview { font-size: .85rem; font-weight: 700; color: #1a2d30; }
.apt-group-item-meta { margin-top: .2rem; font-size: .76rem; color: #637376; }
.apt-groups-empty { font-size: .85rem; color: #617174; }
.apt-card { background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: .75rem; }
.apt-card-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; cursor: pointer; }
.apt-card-preview { font-weight: 600; font-size: .9rem; }
.apt-card-date { font-size: .78rem; opacity: .6; margin-top: .15rem; }
.apt-status-badge { display: inline-block; padding: .2rem .65rem; border-radius: 99px; font-size: .75rem; font-weight: 600; flex-shrink: 0; }
.apt-status-badge.pending   { background: #fef3c7; color: #92400e; }
.apt-status-badge.confirmed { background: #d1fae5; color: #065f46; }
.apt-status-badge.cancelled { background: #fee2e2; color: #991b1b; }
.apt-card-detail { display: none; border-top: 1px solid var(--border, #e5e7eb); margin-top: .75rem; padding-top: .75rem; font-size: .875rem; }
.apt-card-detail.open { display: block; }
.apt-card-detail dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; }
.apt-card-detail dt { font-weight: 600; color: var(--text-muted, #6b7280); white-space: nowrap; }
.apt-card-detail dd { margin: 0; word-break: break-word; }

/* Appointments Table View */
.apt-table-panel { display: none; margin: 0 0 1rem; }
.apt-table-panel.open { display: block; }
.apt-table-group { border: 1px solid #d8e1dd; border-radius: 14px; background: #fff; overflow: hidden; margin-bottom: .7rem; }
.apt-table-group-header { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: .85rem; padding: .9rem 1rem; }
.apt-table-group-header::-webkit-details-marker { display: none; }
.apt-table-group summary::after { content: "▼"; font-size: .78rem; color: #607275; transition: transform .2s ease; flex-shrink: 0; }
.apt-table-group[open] summary::after { transform: rotate(180deg); }
.apt-table-group-body { padding: 0 .75rem 1rem; border-top: 1px solid #e7eeea; }
.apt-table-group-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; margin: .7rem 0 .5rem; }
.apt-table-group-toolbar .cta { padding: .3rem .75rem; font-size: .78rem; }
.apt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border,#e5e7eb); border-radius: 10px; }
.apt-table { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 480px; }
.apt-table thead { background: #f3f4f6; position: sticky; top: 0; z-index: 1; }
.apt-table th { text-align: left; padding: .55rem .75rem; font-weight: 700; font-size: .78rem; color: #374151; white-space: nowrap; border-bottom: 2px solid #e5e7eb; }
.apt-table td { padding: .5rem .75rem; border-bottom: 1px solid #f0f0f0; vertical-align: top; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apt-table tbody tr:hover { background: #f9fafb; }
.apt-table tbody tr:last-child td { border-bottom: none; }
.apt-table .apt-table-date { font-size: .76rem; opacity: .6; white-space: nowrap; }

/* AgendaAi do Bot */
.botagenda-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem; }
.botagenda-toggle-row { display: inline-flex; align-items: center; gap: .6rem; font-size: .86rem; }
.botagenda-toggle-row input { accent-color: #0f766e; width: 16px; height: 16px; }
.botagenda-status { font-size: .76rem; border-radius: 99px; padding: .15rem .55rem; font-weight: 700; display: inline-block; }
.botagenda-status.active { background: #d1fae5; color: #065f46; }
.botagenda-status.paused { background: #fef3c7; color: #92400e; }
.botagenda-list { display: flex; flex-direction: column; gap: .65rem; }
.botagenda-card { border: 1px solid var(--border, #e5e7eb); border-radius: 10px; background: var(--surface, #fff); padding: .9rem 1rem; }
.botagenda-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .7rem; flex-wrap: wrap; }
.botagenda-card-title { margin: 0; font-size: .92rem; font-weight: 700; }
.botagenda-card-meta { margin: .2rem 0 0; font-size: .78rem; opacity: .65; }
.botagenda-card-trigger { margin: .45rem 0 0; font-size: .82rem; color: #4b5563; }
.botagenda-card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.botagenda-editor { margin-top: 1rem; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; background: #f9fafb; padding: 1rem; }
.botagenda-editor.hidden { display: none; }
.botagenda-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.botagenda-field { display: flex; flex-direction: column; gap: .35rem; }
.botagenda-field label { font-size: .8rem; font-weight: 600; }
.botagenda-field input,
.botagenda-field select,
.botagenda-field textarea { width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: .5rem .7rem; font-size: .86rem; font-family: inherit; outline: none; }
.botagenda-field textarea { resize: vertical; min-height: 74px; }
.botagenda-fields-list { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; }
.botagenda-field-item { border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; padding: .7rem; transition: border-color .16s ease, box-shadow .16s ease, opacity .16s ease, transform .16s ease; }
.botagenda-field-item.dragging { opacity: .55; transform: scale(.995); }
.botagenda-field-item.drag-over { border-color: var(--brand,#0f766e); box-shadow: 0 0 0 3px rgba(15,118,110,.12); background: #f0fdfa; }
.botagenda-field-item-grid { display: grid; grid-template-columns: 1.3fr .9fr auto auto; gap: .5rem; align-items: center; }
.botagenda-field-item-grid input,
.botagenda-field-item-grid select { width: 100%; border: 1px solid #d1d5db; border-radius: 7px; padding: .4rem .55rem; font-size: .83rem; font-family: inherit; }
.botagenda-required { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; }
.botagenda-options-wrap { margin-top: .55rem; }
.botagenda-actions-row { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .9rem; flex-wrap: wrap; }
@media (max-width: 700px) {
  .botagenda-editor-grid { grid-template-columns: 1fr; }
  .botagenda-field-item-grid { grid-template-columns: 1fr; }
  .botagenda-required { justify-content: flex-start; }
}

/* ── AgendaAi Standalone ──────────────────────────────── */
.agendaai-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: .75rem; }
.agendaai-form-card { background: var(--surface,#fff); border: 1px solid var(--border,#e5e7eb); border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: .85rem; }
.agendaai-form-title { font-weight: 700; font-size: 1rem; margin: 0 0 .2rem; }
.agendaai-form-link  { font-size: .8rem; color: var(--brand,#0f766e); word-break: break-all; margin: 0 0 .5rem; }
.agendaai-form-meta  { font-size: .78rem; opacity: .6; margin: 0; }
.agendaai-form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; align-items: center; }
.agendaai-badge-active { background: #d1fae5; color: #065f46; }
.agendaai-badge-paused { background: #fef3c7; color: #92400e; }
.agendaai-subs-panel { display: none; border-top: 1px solid var(--border,#e5e7eb); margin-top: .85rem; padding-top: .85rem; }
.agendaai-subs-panel.open { display: block; }
.agendaai-sub-row { border: 1px solid var(--border,#e5e7eb); border-radius: 8px; margin-bottom: .5rem; overflow: hidden; }
.agendaai-sub-header { display: flex; align-items: center; gap: .75rem; padding: .65rem 1rem; cursor: pointer; flex-wrap: wrap; }
.agendaai-sub-header:hover { background: #f9fafb; }
.agendaai-sub-badge-new  { display: inline-block; background: #3b82f6; color: #fff; font-size: .68rem; font-weight: 700; padding: .15rem .5rem; border-radius: 99px; text-transform: uppercase; flex-shrink: 0; }
.agendaai-sub-badge-seen { display: inline-block; background: #e5e7eb; color: #6b7280; font-size: .68rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; flex-shrink: 0; }
.agendaai-sub-preview { font-size: .875rem; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agendaai-sub-date  { font-size: .75rem; opacity: .55; flex-shrink: 0; }
.agendaai-sub-body  { display: none; border-top: 1px solid var(--border,#e5e7eb); padding: .75rem 1rem; background: #fafafa; }
.agendaai-sub-row.open .agendaai-sub-body { display: block; }
.agendaai-sub-body dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; margin: 0; font-size: .875rem; }
.agendaai-sub-body dt { font-weight: 600; color: #6b7280; white-space: nowrap; }
.agendaai-sub-body dd { margin: 0; word-break: break-word; }
.agendaai-entitlement-banner { border: 1px solid #e5e7eb; border-radius: 10px; padding: .75rem .9rem; margin: 0 0 1rem; font-size: .84rem; line-height: 1.4; }
.agendaai-entitlement-banner p { margin: .35rem 0 0; }
.agendaai-entitlement-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .65rem; }
.agendaai-entitlement-ok { background: #ecfdf5; border-color: #86efac; color: #14532d; }
.agendaai-entitlement-warn { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.agendaai-entitlement-blocked { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.agendaai-entitlement-unknown { background: #f9fafb; border-color: #d1d5db; color: #374151; }
.agendaai-action-lock { margin: .25rem 0 1rem; font-size: .82rem; color: #92400e; }
.agendaai-action-lock.hidden { display: none; }
