    :root {
      --bg: #0f172a;
      --card: #ffffff;
      --text: #0f172a;
      --muted: #475569;
      --line: #e2e8f0;
      --accent: #2563eb;
    }
    * { box-sizing: border-box; }
    html, body { height: 100%; overflow: hidden; }
    body {
      margin: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
      background: #f0f2f5;
      color: var(--text);
      min-height: 100dvh;
    }

    /* === APP SHELL === */
    .app-shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
    .app-header { display: none; }
    .app-body { display: flex; flex: 1; overflow: hidden; width: 100%; min-height: 0; }

    /* === SIDEBAR === */
    .sidebar {
      width: 220px;
      min-width: 220px;
      background: #0f172a;
      display: flex;
      flex-direction: column;
      flex-shrink: 0;
      overflow-y: auto;
      overflow-x: hidden;
      transition: width .18s ease, min-width .18s ease;
    }
    .sidebar::-webkit-scrollbar { width: 4px; }
    .sidebar::-webkit-scrollbar-track { background: transparent; }
    .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

    .sidebar-brand {
      padding: 18px 16px 14px;
      border-bottom: 1px solid rgba(255,255,255,0.07);
      display: flex; align-items: center; gap: 10px;
      flex-shrink: 0;
      position: relative;
    }
    .sidebar-brand-text {
      min-width: 0;
      flex: 1;
    }
    .sidebar-brand-icon {
      width: 34px; height: 34px; border-radius: 9px;
      background: linear-gradient(135deg, #16a34a, #059669);
      display: flex; align-items: center; justify-content: center;
      font-size: 17px; flex-shrink: 0;
      box-shadow: 0 2px 8px rgba(22,163,74,0.35);
    }
    .sidebar-brand-name {
      font-size: 14px; font-weight: 700; color: #f1f5f9;
      letter-spacing: -0.01em; line-height: 1.2;
    }
    .sidebar-brand-sub { font-size: 10px; color: #64748b; margin-top: 1px; }
    .sidebar-toggle {
      width: 32px;
      height: 32px;
      padding: 0;
      border-radius: 8px;
      border: 1px solid rgba(148,163,184,0.2);
      background: rgba(255,255,255,0.04);
      color: #cbd5e1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .sidebar-toggle:hover {
      background: rgba(255,255,255,0.08);
      color: #f8fafc;
    }

    .sidebar-section {
      padding: 14px 16px 4px;
      font-size: 9.5px; font-weight: 700;
      color: #475569; text-transform: uppercase; letter-spacing: 0.09em;
    }
    .sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 6px 0; }
    .sidebar-spacer { flex: 1; min-height: 12px; }
    .sidebar-bottom { padding: 8px 0 12px; border-top: 1px solid rgba(255,255,255,0.06); }

    .nav-btn {
      width: 100%; height: 38px;
      background: transparent; border: none; border-radius: 0;
      cursor: pointer;
      display: flex; align-items: center;
      padding: 0 16px; gap: 10px;
      color: #64748b; font-size: 13px; font-weight: 500;
      text-align: left; white-space: nowrap;
      transition: background .12s, color .12s;
      position: relative;
    }
    .nav-btn:hover { background: rgba(255,255,255,0.05); color: #cbd5e1; }
    .nav-btn.active { background: rgba(22,163,74,0.15); color: #4ade80; }
    .nav-btn.active::before {
      content: ''; position: absolute;
      left: 0; top: 6px; bottom: 6px;
      width: 3px; background: #16a34a; border-radius: 0 2px 2px 0;
    }
    .nav-icon { width: 17px; height: 17px; flex-shrink: 0; display: block; }
    .nav-label { font-size: 13px; font-weight: 500; }
    .nav-btn-danger { color: #f87171 !important; }
    .nav-btn-danger:hover { background: rgba(239,68,68,0.1) !important; color: #fca5a5 !important; }

    .app-shell.sidebar-collapsed .sidebar {
      width: 72px;
      min-width: 72px;
    }
    .app-shell.sidebar-collapsed .sidebar-brand {
      padding-left: 12px;
      padding-right: 12px;
      justify-content: center;
    }
    .app-shell.sidebar-collapsed .sidebar-brand-text,
    .app-shell.sidebar-collapsed .sidebar-section,
    .app-shell.sidebar-collapsed .nav-label,
    .app-shell.sidebar-collapsed #sidebarLoggedAdmin {
      display: none !important;
    }
    .app-shell.sidebar-collapsed .sidebar-toggle {
      position: absolute;
      top: 8px;
      right: 8px;
      width: 30px;
      height: 30px;
      border-color: rgba(148,163,184,0.35);
      background: rgba(15,23,42,0.96);
      box-shadow: 0 0 0 1px rgba(15,23,42,0.4);
      z-index: 3;
    }
    .app-shell.sidebar-collapsed .nav-btn {
      justify-content: center;
      padding: 0;
    }
    .app-shell.sidebar-collapsed .sidebar-bottom {
      padding-top: 10px;
    }
    .app-shell.sidebar-collapsed .nav-btn.active::before {
      top: 8px;
      bottom: 8px;
    }

    /* === PANELS === */
    .panels-area { flex: 1; overflow: hidden; position: relative; min-width: 0; min-height: 0; }
    .panel { display: none; flex-direction: column; height: 100%; overflow: hidden; min-width: 0; min-height: 0; }
    .panel.active { display: flex; }

    .panel-hdr {
      display: flex; align-items: center; justify-content: space-between;
      padding: 10px 20px;
      background: #fff;
      border-bottom: 1px solid var(--line);
      flex-shrink: 0;
    }
    .panel-hdr h2 { margin: 0; font-size: 16px; }
    .panel-body { flex: 1; overflow-y: auto; padding: 20px; }
    .panel-stack {
      width: 100%;
      display: flex;
      flex-direction: column;
      gap: 16px;
      align-items: stretch;
    }
    .panel-card {
      width: 100%;
      max-width: none;
      box-sizing: border-box;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 20px;
    }
    .panel-card.subtle {
      background: #f8fafc;
      border-color: #e2e8f0;
    }
    .panel-form-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(240px, 1fr));
      gap: 12px;
      align-items: start;
    }
    .panel-form-grid > .full { grid-column: 1 / -1; }
    .panel-card input[type=text],
    .panel-card input[type=password],
    .panel-card input[type=number],
    .panel-card input[type=tel],
    .panel-card input[type=date],
    .panel-card select,
    .panel-card textarea {
      width: 100%;
    }
    .panel-inline-actions {
      margin-top: 10px;
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }
    .catalogo-form-stack {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .catalogo-form-block {
      background: #f8fafc;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 12px;
    }
    .catalogo-form-block-title {
      margin: 0 0 10px;
      font-size: 12px;
      font-weight: 700;
      color: #334155;
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }
    .catalogo-form-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(220px, 1fr));
      gap: 10px;
      align-items: start;
    }
    .catalogo-form-grid > .full {
      grid-column: 1 / -1;
    }
    .add-form-toolbar {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 0 0 12px;
      flex-wrap: wrap;
    }
    .add-form-card {
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 16px;
      margin-bottom: 16px;
      display: none;
    }
    .add-form-card.open {
      display: block;
    }

    /* editor panel body — no scroll, manages children via flex */
    .editor-body {
      flex: 1; display: flex; flex-direction: column;
      overflow: hidden; padding: 14px 20px 12px;
    }
    .editor-tabs-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
    #panelJson, #panelMd { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
    #panelMd { position: relative; }
    .md-editor-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
    #mdFindBackdrop {
      display: none;
      position: absolute; top: 0; left: 0; right: 0; bottom: 0;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 13px; line-height: 1.6;
      padding: 12px 14px;
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      white-space: pre-wrap; word-wrap: break-word;
      overflow: hidden; pointer-events: none;
      color: transparent; background: transparent;
      border-color: transparent;
      box-sizing: border-box;
      z-index: 2;
    }
    #mdFindBackdrop.active    { display: block; }
    #mdFindBackdrop mark      { background: #fde68a; color: #1e293b; border-radius: 2px; }
    #mdFindBackdrop mark.curr { background: #f97316; color: #fff; }
    #mdValuesView {
      display: none;
      position: absolute; top: 0; left: 0; right: 0; bottom: 0;
      z-index: 4;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 13px; line-height: 1.6;
      padding: 12px 14px;
      border: 1px solid #6366f1; border-radius: 8px;
      white-space: pre-wrap; word-wrap: break-word;
      overflow-y: auto;
      color: #1e293b; background: #fff;
      box-sizing: border-box;
      pointer-events: none;
      cursor: default;
    }
    #mdValuesView.active { display: block; }
    #mdValuesView .ph-val { color: #6366f1; font-size: 0.82em; font-style: italic; }
    #mdFindBackdrop { z-index: 5; }
    #showMdValuesBtn.active { background: #ede9fe; color: #6366f1; border-color: #a5b4fc; }
    .md-editor-wrap textarea  { position: relative; z-index: 1; pointer-events: auto; cursor: text; }
    #mdEditor.values-active {
      color: transparent;
      -webkit-text-fill-color: transparent;
    }
    #mdEditor.find-active     { opacity: 0; }
    #workflowJson.find-active { opacity: 0; }
    #jsonFindBackdrop {
      display: none;
      position: absolute; top: 0; left: 0; right: 0; bottom: 0;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 13px; line-height: 1.6;
      padding: 12px 14px;
      border: 1px solid #334155;
      border-radius: 8px;
      white-space: pre-wrap; word-wrap: break-word;
      overflow: hidden; pointer-events: none;
      color: transparent; background: transparent;
      border-color: transparent;
      box-sizing: border-box;
      z-index: 2;
    }
    #jsonFindBackdrop.active    { display: block; }
    #jsonFindBackdrop mark      { background: #854d0e; color: #fef3c7; border-radius: 2px; }
    #jsonFindBackdrop mark.curr { background: #f97316; color: #fff; }
    #panelJson textarea, #panelMd textarea {
      flex: 1; min-height: 0; resize: none;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      background: #0f172a;
      color: #e2e8f0;
    }
    #panelDiagram { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
    .editor-footer { flex-shrink: 0; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }

    h1, h2 { margin-top: 0; }
    .row {
      display: grid;
      gap: 10px;
      margin-top: 8px;
    }
    textarea, input[type=text], input[type=password], input[type=number], input[type=tel], input[type=date], select {
      font-family: inherit;
      font-size: 14px;
      border: 1px solid #cbd5e1;
      border-radius: 8px;
      padding: 12px 14px;
      background: #ffffff;
      color: var(--text);
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
      box-sizing: border-box;
      box-shadow: 0 1px 2px rgba(0,0,0, 0.03);
    }
    textarea:focus, input[type=text]:focus, input[type=password]:focus, input[type=number]:focus, input[type=tel]:focus, input[type=date]:focus, select:focus {
      outline: none;
      background: #ffffff;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    }
    textarea {
      width: 100%;
      min-height: 120px;
      resize: vertical;
    }
    /* Estilo premium para rótulos (labels) de campos */
    label[style*="display:block"] {
      font-size: 13px !important;
      font-weight: 600 !important;
      color: #1e293b !important;
      margin-bottom: 6px !important;
    }
    button {
      padding: 10px 18px;
      border-radius: 8px;
      border: none;
      background: var(--accent);
      color: #fff;
      cursor: pointer;
      font-weight: 600;
      font-size: 14px;
      transition: all 0.2s ease;
      box-shadow: 0 2px 5px rgba(37,99,235, 0.2);
    }
    button:active { transform: scale(0.96); box-shadow: 0 1px 2px rgba(37,99,235, 0.2); }
    button:hover { filter: brightness(1.1); box-shadow: 0 3px 8px rgba(37,99,235, 0.3); }
    .actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }
    .muted { color: var(--muted); font-size: 13px; }
    pre {
      background: #0f172a;
      color: #e2e8f0;
      padding: 12px;
      border-radius: 8px;
      overflow: auto;
    }

    /* === TABS === */
    .card-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 4px;
    }
    .card-top h2 { margin: 0; }
    .tab-bar {
      display: flex;
      gap: 4px;
    }
    .tab-btn {
      background: transparent;
      border: 1px solid var(--line);
      color: var(--muted);
      padding: 5px 14px;
      border-radius: 6px;
      font-size: 13px;
      cursor: pointer;
    }
    .tab-btn.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }

    /* === MD PREVIEW === */
    .md-preview {
      min-height: 280px;
      max-height: 500px;
      overflow-y: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 16px 20px;
      background: #fff;
      font-family: Arial, sans-serif;
      font-size: 14px;
      line-height: 1.6;
      color: #1e293b;
    }
    .md-preview h1 { font-size: 20px; border-bottom: 2px solid var(--line); padding-bottom: 6px; margin-top: 0; }
    .md-preview h2 { font-size: 16px; color: #475569; margin-top: 20px; margin-bottom: 4px; }
    .md-preview h3 {
      font-size: 14px;
      background: #f1f5f9;
      border-left: 3px solid var(--accent);
      padding: 5px 10px;
      border-radius: 0 6px 6px 0;
      margin-top: 16px;
      margin-bottom: 6px;
    }
    .md-preview hr { border: none; border-top: 1px solid var(--line); margin: 8px 0; }
    .md-preview p { margin: 3px 0; }
    .md-preview ul { margin: 4px 0 4px 18px; padding: 0; }
    .md-preview li { margin: 2px 0; }
    .md-preview code {
      background: #f1f5f9;
      color: #0f172a;
      padding: 1px 5px;
      border-radius: 4px;
      font-family: ui-monospace, monospace;
      font-size: 12px;
    }
    .md-preview blockquote {
      border-left: 3px solid #25D366;
      margin: 6px 0;
      padding: 4px 12px;
      background: #f0fdf4;
      border-radius: 0 6px 6px 0;
      color: #166534;
      font-size: 13px;
    }
    .md-preview strong { color: #0f172a; }
    .md-preview .badge-type {
      display: inline-block;
      font-size: 11px;
      font-weight: bold;
      padding: 2px 7px;
      border-radius: 10px;
      margin-left: 6px;
      vertical-align: middle;
    }
    .md-preview .badge-condition { background: #fef9c3; color: #854d0e; }
    .md-preview .badge-reply     { background: #dcfce7; color: #166534; }
    .md-preview .badge-set       { background: #e0f2fe; color: #0369a1; }
    .md-preview .badge-http      { background: #fce7f3; color: #9d174d; }

    #mdEditor {
      background: #fff;
      color: #1e293b;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 13px;
      line-height: 1.6;
    }
    .md-autocomplete {
      position: absolute;
      min-width: 320px;
      max-width: 560px;
      max-height: 260px;
      overflow-y: auto;
      background: #ffffff;
      border: 1px solid #cbd5e1;
      border-radius: 10px;
      box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
      z-index: 30;
    }
    .md-autocomplete-item {
      width: 100%;
      border: none;
      border-bottom: 1px solid #e2e8f0;
      border-radius: 0;
      background: transparent;
      color: #0f172a;
      text-align: left;
      padding: 8px 10px;
      box-shadow: none;
      cursor: pointer;
      display: grid;
      gap: 2px;
    }
    .md-autocomplete-item:last-child { border-bottom: none; }
    .md-autocomplete-item:hover,
    .md-autocomplete-item.active {
      background: #eff6ff;
    }
    .md-autocomplete-code {
      font-size: 12px;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      color: #0f172a;
    }
    .md-autocomplete-meta {
      font-size: 11px;
      color: #475569;
    }
    .btn-secondary {
      background: #64748b;
      border-color: #64748b;
    }
    .btn-green {
      background: #16a34a;
      border-color: #16a34a;
    }
    .md-status {
      font-size: 13px;
      padding: 6px 10px;
      border-radius: 6px;
      display: none;
    }
    .md-status.ok  { background: #f0fdf4; color: #166534; display: block; }
    .md-status.err { background: #fef2f2; color: #991b1b; display: block; }

    /* === BARRA DE LOCALIZAR === */
    .md-find-bar {
      display: none;
      align-items: center;
      gap: 6px;
    }
    .md-find-bar.open { display: flex; }
    .md-find-bar input {
      width: 220px;
      padding: 4px 8px;
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      font-size: 13px;
      outline: none;
    }
    .md-find-bar input:focus { border-color: #6366f1; }
    .md-find-count {
      font-size: 12px;
      color: #64748b;
      white-space: nowrap;
      min-width: 52px;
      text-align: center;
    }
    .md-find-btn {
      background: #e2e8f0;
      border: none;
      border-radius: 6px;
      padding: 4px 8px;
      cursor: pointer;
      font-size: 13px;
      color: #334155;
      line-height: 1;
    }
    .md-find-btn:hover { background: #cbd5e1; }
    .md-find-btn.close { color: #94a3b8; }
    .md-find-noresult input { border-color: #fca5a5 !important; background: #fef2f2; }

    @media (max-width: 920px) {
      .panel-form-grid { grid-template-columns: 1fr; }
    }

    /* === FLUXOGRAMA === */
    .dg-toolbar {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 4px;
      padding: 0 0 8px 0;
    }
    .dg-tool-btn {
      background: #f1f5f9;
      border: 1px solid var(--line);
      color: #0f172a;
      width: 30px;
      height: 30px;
      border-radius: 6px;
      font-size: 16px;
      cursor: pointer;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .dg-tool-btn:hover { background: #e2e8f0; }
    .dg-tool-btn.is-active {
      background: #dbeafe;
      border-color: #93c5fd;
      color: #1d4ed8;
    }
    .dg-tool-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }
    .dg-zoom-label {
      font-size: 13px;
      min-width: 44px;
      text-align: center;
      color: var(--muted);
    }
    .dg-tool-group {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 8px;
      border: 1px solid rgba(148,163,184,.28);
      border-radius: 10px;
      background: rgba(255,255,255,.86);
      box-shadow: 0 1px 2px rgba(15,23,42,.04);
    }
    .dg-tool-group-label {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: .08em;
      text-transform: uppercase;
      color: #64748b;
      padding: 0 2px;
    }
    .dg-search-wrap {
      margin-left: auto;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .dg-search-input {
      width: 250px;
      max-width: 48vw;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 7px 10px;
      font-size: 12px;
      outline: none;
      background: #fff;
      color: #0f172a;
    }
    .dg-search-input:focus {
      border-color: #3b82f6;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    }
    .dg-search-count {
      font-size: 11px;
      color: var(--muted);
      min-width: 40px;
      text-align: center;
    }
    .diagram-container {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #f0f4f8;
      background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px);
      background-size: 24px 24px;
      overflow: hidden;
      flex: 1;
      min-height: 0;
      position: relative;
      cursor: grab;
      user-select: none;
    }
    .diagram-container:active { cursor: grabbing; }
    #diagramViewport {
      position: absolute;
      top: 0; left: 0;
      transform-origin: 0 0;
      will-change: transform;
    }
    #diagramSelectionBox {
      position: absolute;
      display: none;
      border: 1.5px dashed #2563eb;
      background: rgba(37, 99, 235, 0.12);
      border-radius: 8px;
      pointer-events: none;
      z-index: 5;
    }
    #diagramConnectionOverlay {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 4;
      overflow: visible;
    }
    .dg-node { cursor: pointer; }
    .dg-node:hover > rect { filter: brightness(0.93); }
    .dg-node.dg-selected > rect {
      stroke: #2563eb !important;
      stroke-width: 3px !important;
      filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.28));
    }
    .dg-node.dg-match > rect {
      stroke: #f59e0b !important;
      stroke-width: 2.6 !important;
      filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.35));
    }
    .dg-node.dg-current > rect {
      stroke: #dc2626 !important;
      stroke-width: 3.2 !important;
      filter: drop-shadow(0 0 9px rgba(220, 38, 38, 0.45));
    }
    .dg-tool-btn.is-active {
      background: #dbeafe;
      border-color: #60a5fa;
      color: #1d4ed8;
      box-shadow: inset 0 0 0 1px rgba(59,130,246,.12);
    }
    .dg-tool-btn:disabled {
      opacity: .5;
      cursor: not-allowed;
    }
    .dg-connector-handle {
      cursor: crosshair;
    }
    .dg-connector-handle circle {
      fill: #ffffff;
      stroke-width: 2;
    }
    .dg-connector-handle text {
      font-size: 9px;
      font-weight: 700;
      text-anchor: middle;
      dominant-baseline: central;
      pointer-events: none;
    }
    .dg-connector-input circle {
      fill: #f8fafc;
      stroke: #94a3b8;
      stroke-width: 1.5;
      opacity: .9;
    }

    /* === STEP EDITOR MODAL === */
    .step-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15,23,42,0.4);
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .step-modal-box {
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 24px 64px rgba(0,0,0,0.25);
      width: 500px;
      max-width: 96vw;
      max-height: 88vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .step-modal-hdr {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px;
      border-bottom: 1px solid var(--line);
    }
    .step-modal-hdr strong { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing:.05em; }
    .step-modal-hdr span { font-size: 16px; font-weight: 700; font-family: monospace; }
    .step-modal-close {
      background: transparent; border: none; color: var(--muted);
      font-size: 20px; cursor: pointer; padding: 2px 8px; border-radius: 4px; line-height: 1;
    }
    .step-modal-close:hover { background: #f1f5f9; }
    .step-modal-body {
      padding: 16px; overflow-y: auto; flex: 1;
      display: flex; flex-direction: column; gap: 12px;
    }
    .step-field { display: flex; flex-direction: column; gap: 4px; }
    .step-field label {
      font-size: 11px; font-weight: 700; color: var(--muted);
      text-transform: uppercase; letter-spacing: .06em;
    }
    .step-modal-body input,
    .step-modal-body select { background: #fff !important; color: #0f172a !important; }
    .step-modal-body textarea {
      background: #0f172a !important; color: #e2e8f0 !important;
      font-family: ui-monospace, monospace !important; font-size: 13px !important;
      min-height: 110px; resize: vertical;
    }
    .step-modal-ftr {
      padding: 12px 16px; border-top: 1px solid var(--line);
      display: flex; gap: 8px; justify-content: flex-end;
    }
    .confirm-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15,23,42,0.42);
      z-index: 1300;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    .confirm-modal-box {
      width: 420px;
      max-width: 96vw;
      background: #fff;
      border-radius: 16px;
      box-shadow: 0 24px 64px rgba(15,23,42,0.28);
      border: 1px solid rgba(148,163,184,0.25);
      overflow: hidden;
    }
    .confirm-modal-hdr {
      padding: 16px 18px 10px;
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .confirm-modal-icon {
      width: 42px;
      height: 42px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: #fee2e2;
      color: #b91c1c;
      font-size: 20px;
      flex: 0 0 auto;
    }
    .confirm-modal-title {
      font-size: 18px;
      font-weight: 700;
      color: #0f172a;
      margin: 0;
    }
    .confirm-modal-body {
      padding: 0 18px 18px;
      color: #475569;
      font-size: 14px;
      line-height: 1.5;
    }
    .confirm-modal-ftr {
      padding: 14px 18px 18px;
      border-top: 1px solid #e2e8f0;
      display: flex;
      justify-content: flex-end;
      gap: 10px;
    }
    .workflow-version-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15,23,42,0.42);
      z-index: 1150;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    .workflow-version-modal {
      width: min(860px, 96vw);
      max-height: 88vh;
      background: #fff;
      border-radius: 16px;
      box-shadow: 0 24px 64px rgba(15,23,42,0.28);
      border: 1px solid rgba(148,163,184,0.25);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }
    .workflow-version-modal.small {
      width: min(560px, 94vw);
    }
    .workflow-version-modal-hdr {
      padding: 16px 18px 10px;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid #e2e8f0;
    }
    .workflow-version-modal-hdr h3 {
      margin: 0;
      font-size: 18px;
      color: #0f172a;
    }
    .workflow-version-modal-subtitle {
      margin: 4px 0 0;
      color: #64748b;
      font-size: 13px;
      line-height: 1.4;
    }
    .workflow-version-modal-close {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      border: 1px solid #dbe2ea;
      background: #fff;
      color: #475569;
      font-size: 18px;
      line-height: 1;
      cursor: pointer;
      flex: 0 0 auto;
    }
    .workflow-version-modal-body {
      padding: 16px 18px;
      overflow: auto;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .workflow-version-modal-ftr {
      padding: 14px 18px 18px;
      border-top: 1px solid #e2e8f0;
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      background: #f8fafc;
    }
    .workflow-version-modal textarea {
      width: 100%;
      min-height: 130px;
      resize: vertical;
      border: 1px solid #cbd5e1;
      border-radius: 12px;
      padding: 12px 14px;
      font-size: 14px;
      color: #0f172a;
      outline: none;
    }
    .workflow-version-modal textarea:focus {
      border-color: #3b82f6;
      box-shadow: 0 0 0 3px rgba(59,130,246,.14);
    }
    .workflow-history-list {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .workflow-history-item {
      border: 1px solid #dbe2ea;
      border-radius: 14px;
      padding: 14px 16px;
      background: #fff;
      display: grid;
      grid-template-columns: minmax(0,1fr) auto;
      gap: 12px;
      align-items: start;
    }
    .workflow-history-item.is-current {
      border-color: #93c5fd;
      box-shadow: inset 0 0 0 1px rgba(59,130,246,.18);
      background: #f8fbff;
    }
    .workflow-history-item.is-selected {
      border-color: #2563eb;
      box-shadow: inset 0 0 0 2px rgba(37,99,235,.18);
      background: #eff6ff;
    }
    .workflow-history-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 10px;
      margin-bottom: 8px;
      font-size: 12px;
      color: #64748b;
    }
    .workflow-history-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .03em;
      text-transform: uppercase;
      background: #e2e8f0;
      color: #334155;
    }
    .workflow-history-badge.current {
      background: #dbeafe;
      color: #1d4ed8;
    }
    .workflow-history-comment {
      white-space: pre-wrap;
      color: #0f172a;
      font-size: 14px;
      line-height: 1.45;
    }
    .workflow-history-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
      min-width: 110px;
    }
    .workflow-history-actions button:disabled,
    .workflow-version-modal-ftr button:disabled {
      opacity: .55;
      cursor: not-allowed;
    }
    .workflow-history-empty {
      padding: 24px 12px;
      text-align: center;
      color: var(--muted);
      font-size: 14px;
    }

    /* === CHAT WHATSAPP === */
    .chat-wrapper {
      border-radius: 10px;
      overflow: hidden;
      border: 1px solid #ccc;
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      min-height: 0;
    }
    .chat-header {
      background: #075E54;
      color: #fff;
      padding: 10px 14px;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .chat-avatar {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      background: #25D366;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
    }
    .chat-header-info strong { display: block; font-size: 15px; }
    .chat-header-info span { font-size: 12px; opacity: 0.8; }
    .chat-messages {
      background: #e5ddd5;
      background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9c0b5' fill-opacity='0.3'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
      overflow-y: auto;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      scroll-behavior: smooth;
    }
    .chat-bubble {
      max-width: 72%;
      padding: 7px 10px 18px 10px;
      border-radius: 8px;
      font-size: 13.5px;
      white-space: normal;
      line-height: 1.4;
      position: relative;
      word-break: break-word;
      box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    }
    .chat-bubble.user {
      background: #dcf8c6;
      align-self: flex-end;
      border-bottom-right-radius: 2px;
    }
    .chat-bubble.bot {
      background: #ffffff;
      align-self: flex-start;
      border-bottom-left-radius: 2px;
    }
    .chat-bubble code,
    .at-bubble code {
      background: transparent;
      color: inherit;
      padding: 0;
      border-radius: 0;
      font-family: inherit;
      font-size: inherit;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .chat-bubble .time {
      position: absolute;
      bottom: 4px;
      right: 8px;
      font-size: 10px;
      color: #8a9ca0;
    }
    .chat-bubble.user .time {
      right: 8px;
    }
    .chat-bubble .check {
      margin-left: 2px;
      color: #4fc3f7;
    }
    .delivery-check { font-size:11px; margin-left:4px; display:inline-block; transition:color .3s; }
    .ds-Pending   { color:#9ca3af; }
    .ds-Sent      { color:#9ca3af; }
    .ds-Delivered { color:#6b7280; }
    .ds-Read      { color:#53bdeb; }
    /* AI toggle switch */
    .ai-toggle-label { display:inline-flex; align-items:center; cursor:pointer; }
    .ai-toggle-label input { display:none; }
    .ai-toggle-track { width:44px; height:24px; background:#ccc; border-radius:12px; position:relative; transition:background .2s; }
    .ai-toggle-thumb { width:20px; height:20px; background:#fff; border-radius:50%; position:absolute; top:2px; left:2px; transition:left .2s; box-shadow:0 1px 3px rgba(0,0,0,.3); }
    .ai-toggle-label input:checked ~ .ai-toggle-track { background:#25d366; }
    .ai-toggle-label input:checked ~ .ai-toggle-track .ai-toggle-thumb { left:22px; }
    /* AI icon inline at the start of assistant messages */
    .ai-inline-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      margin-right: 6px;
      border-radius: 999px;
      background: #e3f2fd;
      color: #1565c0;
      font-size: 12px;
      vertical-align: text-top;
    }
    .sim-inline-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      margin-right: 6px;
      border-radius: 999px;
      background: #e8f5e9;
      color: #1b5e20;
      font-size: 12px;
      vertical-align: text-top;
    }
    .msg-tag {
      display: inline-block;
      margin-right: 6px;
      padding: 1px 6px;
      border-radius: 999px;
      border: 1px solid #bfdbfe;
      background: #eff6ff;
      color: #1d4ed8;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: .02em;
      vertical-align: text-top;
    }
    .typing-indicator {
      background: #ffffff;
      align-self: flex-start;
      border-radius: 8px;
      border-bottom-left-radius: 2px;
      padding: 10px 14px;
      box-shadow: 0 1px 2px rgba(0,0,0,0.15);
      display: flex;
      gap: 4px;
      align-items: center;
    }
    .typing-dot {
      width: 7px;
      height: 7px;
      background: #90a4ae;
      border-radius: 50%;
      animation: typingBounce 1.2s infinite ease-in-out;
    }
    .typing-dot:nth-child(2) { animation-delay: 0.2s; }
    .typing-dot:nth-child(3) { animation-delay: 0.4s; }
    @keyframes typingBounce {
      0%, 60%, 100% { transform: translateY(0); }
      30% { transform: translateY(-5px); }
    }
    .chat-input-area {
      background: #f0f0f0;
      padding: 8px 10px;
      display: flex;
      gap: 8px;
      align-items: center;
    }
    .chat-input-area input {
      flex: 1;
      min-width: 0;
      width: 0;
      border-radius: 20px;
      border: none;
      padding: 9px 14px;
      font-size: 14px;
      outline: none;
      background: #fff;
    }
    .chat-send-btn {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: #25D366;
      border: none;
      color: #fff;
      font-size: 18px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      flex-shrink: 0;
    }
    .chat-send-btn:hover { background: #1ebe5d; }

    /* === MOBILE-FIRST NAVIGATION / CHAT === */
    @media (max-width: 700px) {
      html, body { overflow: hidden; }
      .app-shell { min-height: 100dvh; }
      .app-body { display: block; position: relative; }
      .panels-area { width: 100%; height: 100%; padding-bottom: 62px; }

      .sidebar {
        position: fixed;
        z-index: 1000;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        min-width: 0;
        height: 62px;
        max-height: 62px;
        flex-direction: row;
        align-items: stretch;
        overflow-x: auto;
        overflow-y: hidden;
        border-top: 1px solid rgba(255,255,255,0.12);
        box-shadow: 0 -4px 18px rgba(15,23,42,0.22);
      }
      /* O estado desktop recolhido não pode preservar 72px no celular. */
      .app-shell.sidebar-collapsed .sidebar {
        width: 100% !important;
        min-width: 0 !important;
      }
      .sidebar-brand,
      .sidebar-section,
      .sidebar-divider,
      .sidebar-spacer,
      .sidebar-bottom,
      .sidebar-toggle,
      #sidebarLoggedAdmin { display: none !important; }
      .sidebar .nav-btn {
        width: 64px;
        min-width: 64px;
        height: 62px;
        padding: 7px 4px 5px;
        gap: 3px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        border-radius: 0;
      }
      .app-shell.sidebar-collapsed .sidebar .nav-btn {
        width: 64px;
        min-width: 64px;
        height: 62px;
        padding: 7px 4px 5px;
        flex-direction: column;
        justify-content: center;
      }
      .sidebar .nav-icon { width: 20px; height: 20px; }
      .sidebar .nav-label {
        display: block !important;
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 9px;
        line-height: 1.1;
      }
      .app-shell.sidebar-collapsed .sidebar .nav-label {
        display: block !important;
      }
      .sidebar .nav-btn.active::before {
        left: 8px;
        right: 8px;
        top: auto;
        bottom: 0;
        width: auto;
        height: 3px;
        border-radius: 3px 3px 0 0;
      }

      .panel-hdr { padding: 10px 12px; min-height: 48px; }
      .panel-hdr h2 { font-size: 15px; }
      #panel-chat .panel-hdr {
        justify-content: flex-start;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
        white-space: nowrap;
      }
      #panel-chat .panel-hdr h2,
      #panel-chat .panel-hdr > div {
        flex: 0 0 auto;
      }
      #panel-chat .panel-hdr > div {
        max-width: none;
        white-space: nowrap;
      }
      .panel-body { padding: 12px; }
      #panel-chat > div:nth-child(2) { padding: 8px 8px 10px !important; }
      #panel-chat .chat-wrapper { border-radius: 8px; }
      .chat-header { padding: 9px 10px; }
      .chat-messages { padding: 10px 8px; }
      .chat-bubble { max-width: 88%; font-size: 13px; }
      .chat-input-area { padding: 8px; gap: 6px; min-height: 56px; }
      .chat-input-area input { font-size: 16px; min-height: 40px; }
      .chat-send-btn {
        width: 42px;
        min-width: 42px;
        height: 42px;
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
      }
      .chat-from-row { flex-wrap: wrap; }
      .chat-from-row input { min-width: 0; }
    }

    @media (max-width: 380px) {
      .sidebar .nav-btn { width: 58px; min-width: 58px; }
      .sidebar .nav-label { font-size: 8px; }
      .chat-send-btn { width: 40px; min-width: 40px; }
    }
    .chat-from-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
    }
    .chat-from-row label { font-size: 13px; color: var(--muted); white-space: nowrap; }
    .chat-from-row input { flex: 1; }
    .chat-clear-btn {
      background: #64748b;
      border-color: #64748b;
      font-size: 12px;
      padding: 6px 10px;
    }

    /* === LOGIN OVERLAY === */
    .login-overlay {
      position: fixed; inset: 0;
      background: rgba(15,23,42,0.88);
      z-index: 9999;
      display: flex; align-items: center; justify-content: center;
    }
    .login-box {
      background: #fff; border-radius: 16px; padding: 36px 32px;
      width: 360px; max-width: 92vw;
      box-shadow: 0 20px 60px rgba(0,0,0,0.3);
      display: grid;
      gap: 12px;
      box-sizing: border-box;
    }
    .login-box h2 { margin: 0; font-size: 20px; }
    .login-box p  { margin: 0; color: var(--muted); font-size: 14px; }
    .login-box input[type=text],
    .login-box input[type=password] {
      width: 100%; padding: 11px 14px; font-size: 14px;
      border-radius: 8px; border: 1px solid var(--line);
      display: block;
      box-sizing: border-box;
    }
    .login-password-wrap {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      align-items: center;
    }
    .login-password-wrap input[type=password],
    .login-password-wrap input[type=text] {
      margin: 0;
    }
    .login-toggle-btn {
      width: auto !important;
      padding: 11px 12px !important;
      font-size: 12px !important;
      white-space: nowrap;
      background: #475569;
      border-color: #475569;
    }
    .login-box button { width: 100%; padding: 11px; font-size: 14px; box-sizing: border-box; }
    .login-error { color: #dc2626; font-size: 13px; margin: 0; min-height: 18px; }

    /* === ADMIN PANEL === */
    .admin-card {
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 14px 16px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .admin-card-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }
    .admin-card-title {
      font-weight: 700;
      font-size: 14px;
    }
    .admin-card-meta {
      font-size: 12px;
      color: var(--muted);
    }
    .badge-status {
      display: inline-block;
      font-size: 11px;
      font-weight: 700;
      padding: 2px 10px;
      border-radius: 12px;
      text-transform: uppercase;
    }
    .badge-pending   { background: #fef9c3; color: #854d0e; }
    .badge-payment   { background: #dbeafe; color: #1d4ed8; }
    .badge-confirmed { background: #dcfce7; color: #166534; }
    .badge-done      { background: #e9d5ff; color: #6b21a8; }
    .badge-cancelled { background: #fee2e2; color: #991b1b; }
    .badge-open      { background: #dbeafe; color: #1e40af; }
    .booking-inline-details {
      margin-top: 10px;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      background: #f8fafc;
      padding: 0 12px;
      max-height: 0;
      opacity: 0;
      overflow: hidden;
      transition: max-height 0.22s ease, opacity 0.18s ease, padding-top 0.18s ease, padding-bottom 0.18s ease;
    }
    .booking-inline-details.is-open {
      padding-top: 10px;
      padding-bottom: 10px;
      max-height: 1600px;
      opacity: 1;
    }
    .admin-btn-sm {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      font-size: 12px;
      line-height: 1;
      padding: 5px 10px;
      min-height: 32px;
      border-radius: 6px;
    }
    .btn-confirm { background: #16a34a; border-color: #16a34a; }
    .btn-cancel  { background: #dc2626; border-color: #dc2626; }
    .btn-delete  { background: #dc2626; border-color: #dc2626; }
    .btn-restore { background: #2563eb; border-color: #2563eb; }
    .toggle-active {
      appearance: none;
      width: 36px; height: 20px;
      background: #cbd5e1;
      border-radius: 20px;
      cursor: pointer;
      transition: background .2s;
      position: relative;
      flex-shrink: 0;
    }
    .toggle-active::after {
      content: '';
      position: absolute;
      width: 14px; height: 14px;
      background: #fff;
      border-radius: 50%;
      top: 3px; left: 3px;
      transition: transform .2s;
    }
    .toggle-active:checked { background: #16a34a; }
    .toggle-active:checked::after { transform: translateX(16px); }

    /* ── ATENDIMENTO ── */
    .at-shell { display:flex; height:100%; overflow:hidden; min-height:0; min-width:0; }
    .at-sidebar { width:300px; min-width:240px; border-right:1px solid var(--line); display:flex; flex-direction:column; background:#fff; min-height:0; }
    .at-search { padding:10px 12px; border-bottom:1px solid var(--line); }
    .at-search input { width:100%; padding:8px 12px; border:1px solid var(--line); border-radius:8px; font-size:13px; box-sizing:border-box; }
    .at-filters { padding:8px 12px; border-bottom:1px solid var(--line); display:flex; gap:6px; }
    .at-filter-btn {
      padding:3px 10px;
      border:1px solid var(--line);
      border-radius:20px;
      font-size:12px;
      background:none;
      color:var(--muted);
      cursor:pointer;
    }
    .at-filter-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
    #atRefresh { color: var(--muted); }
    .at-user-list { flex:1; overflow-y:auto; }
    .at-user-item { display:flex; gap:10px; padding:12px; border-bottom:1px solid var(--line); cursor:pointer; align-items:flex-start; }
    .at-user-item:hover, .at-user-item.active { background:#f1f5f9; }
    .at-avatar { width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; color:#fff; flex-shrink:0; }
    .at-user-info { flex:1; min-width:0; }
    .at-user-top { display:flex; justify-content:space-between; align-items:center; gap:6px; }
    .at-user-meta { display:flex; align-items:center; gap:8px; flex-shrink:0; }
    .at-user-name { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .at-user-phone { font-size:11px; color:var(--muted); margin:1px 0; }
    .at-user-preview { font-size:12px; color:#555; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
    .at-ai-toggle {
      border:none;
      width:32px;
      height:32px;
      border-radius:50%;
      display:flex;
      align-items:center;
      justify-content:center;
      font-size:16px;
      cursor:pointer;
      background:#dcfce7;
      color:#166534;
    }
    .at-ai-toggle.off { background:#fee2e2; color:#991b1b; }
    .at-ai-toggle:disabled { opacity:0.6; cursor:not-allowed; }
    .at-status { font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; display:inline-block; margin-top:3px; text-transform:uppercase; }
    .at-status-new  { background:#fef3c7; color:#92400e; }
    .at-status-cont { background:#d1fae5; color:#065f46; }
    .at-status-paused { background:#fee2e2; color:#991b1b; }
    .at-chat { flex:1; display:flex; flex-direction:column; background:#f0f2f5; overflow:hidden; min-width:0; min-height:0; }
    .at-chat-empty { flex:1; display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:14px; flex-direction:column; gap:8px; }
    .at-chat-hdr { padding:12px 18px; background:#fff; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:12px; flex-shrink:0; }
    .at-chat-hdr-name { font-weight:700; font-size:15px; }
    .at-chat-hdr-phone { font-size:12px; color:var(--muted); }
    .at-chat-hdr-right { margin-left:auto; display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); }
    .at-chat-hdr-pause { display:flex; align-items:center; gap:6px; cursor:pointer; user-select:none; }
    .at-messages { flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:16px 20px; display:flex; flex-direction:column; gap:10px; min-height:0; }
    .at-msg { max-width:72%; display:flex; flex-direction:column; }
    .at-msg-user { align-self:flex-start; }
    .at-msg-assistant { align-self:flex-end; }
    .at-msg-human { align-self:flex-end; }
    .at-msg-label { font-size:10px; font-weight:700; color:var(--muted); margin-bottom:3px; }
    .at-msg-assistant .at-msg-label { text-align:right; color:#1d4ed8; }
    .at-msg-human .at-msg-label { text-align:right; color:#15803d; }
    .at-bubble { padding:10px 14px; font-size:13px; line-height:1.5; word-break:break-word; }
    .at-bubble-user { background:#fff; border:1px solid var(--line); border-radius:0 12px 12px 12px; }
    .at-bubble-assistant { background:#1d4ed8; color:#fff; border-radius:12px 0 12px 12px; }
    .at-bubble-human { background:#16a34a; color:#fff; border-radius:12px 0 12px 12px; }
    .at-msg-time { font-size:10px; color:var(--muted); margin-top:3px; }
    .at-msg-assistant .at-msg-time, .at-msg-human .at-msg-time { text-align:right; }
    .at-composer { border-top:1px solid var(--line); background:#fff; padding:10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); flex-shrink:0; }
    .at-composer-row { display:flex; align-items:flex-end; gap:8px; }
    .at-composer textarea { flex:1; min-height:42px; max-height:120px; resize:vertical; border:1px solid var(--line); border-radius:10px; padding:10px; font-size:13px; font-family:inherit; box-sizing:border-box; }
    .at-send-btn { border:none; background:#16a34a; color:#fff; border-radius:10px; padding:10px 14px; font-size:13px; font-weight:700; cursor:pointer; min-width:82px; }
    .at-send-btn:disabled { opacity:0.6; cursor:not-allowed; }
    .at-composer-status { font-size:12px; color:var(--muted); min-height:16px; margin-top:6px; }

    @media (max-width: 1180px) {
      .at-sidebar { width: 270px; min-width: 220px; }
      .at-msg { max-width: 82%; }
    }

    @media (max-width: 1024px) {
      .at-shell { flex-direction: column; }
      .at-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 38%;
        border-right: none;
        border-bottom: 1px solid var(--line);
      }
      .at-chat-hdr { padding: 10px 12px; }
      .at-messages { padding: 12px; }
      .at-composer-row { align-items: stretch; }
      .at-composer textarea { min-height: 48px; }
    }

    @media (max-width: 720px) {
      .at-filters { flex-wrap: wrap; }
      .at-msg { max-width: 92%; }
      .at-composer-row { flex-direction: column; }
      .at-send-btn { width: 100%; min-width: 0; }
    }
  
