    :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;
    }

    /* === AGENDA === */
    .agenda-layout { display: flex; height: 100%; overflow: hidden; }
    .agenda-sidebar { width: 220px; min-width: 220px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: #fff; overflow-y: auto; }
    .agenda-sidebar-section { padding: 12px 14px 4px; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
    .agenda-pro-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px; border-left: 2px solid transparent; transition: background .12s; }
    .agenda-pro-item:hover { background: #f8fafc; }
    .agenda-pro-item.active { background: rgba(37,99,235,.06); border-left-color: var(--accent); color: var(--accent); }
    .agenda-pro-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    .agenda-mini-cal { padding: 8px 10px; border-top: 1px solid var(--line); }
    .agenda-mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 2px; font-size: 11px; }
    .agenda-mini-cal-cell { padding: 4px 2px; border-radius: 4px; cursor: pointer; }
    .agenda-mini-cal-cell:hover { background: #f1f5f9; }
    .agenda-mini-cal-cell.today { background: var(--accent); color: #fff; font-weight: 700; }
    .agenda-mini-cal-header { color: var(--muted); font-size: 10px; padding: 4px 0; }
    .agenda-grid-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
    .agenda-header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-shrink: 0; }
    .agenda-header h2 { margin: 0; font-size: 15px; }
    .agenda-header-nav { display: flex; align-items: center; gap: 4px; }
    .agenda-header-nav button {
      min-width: 30px;
      height: 30px;
      padding: 0 10px;
      border: 1px solid var(--line);
      background: #fff;
      color: #334155;
      border-radius: 8px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      box-shadow: none;
      filter: none;
    }
    .agenda-header-nav button:hover {
      background: #f8fafc;
      color: #0f172a;
      box-shadow: none;
      filter: none;
    }
    .agenda-mini-cal button {
      width: 28px;
      height: 28px;
      padding: 0;
      border: 1px solid var(--line);
      background: #fff;
      color: #475569;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 700;
      box-shadow: none;
      filter: none;
    }
    .agenda-mini-cal button:hover {
      background: #f8fafc;
      color: #0f172a;
      box-shadow: none;
      filter: none;
    }
    .agenda-week-grid { flex: 1; overflow: auto; position: relative; }
    .agenda-grid-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
    .agenda-grid-table th { position: sticky; top: 0; background: #f8fafc; padding: 8px 4px; font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); z-index: 2; }
    .agenda-grid-table th.today { background: #eff6ff; color: var(--accent); }
    .agenda-grid-table td { background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; padding: 2px; height: 60px; position: relative; }
    .agenda-grid-table td.today { background: #fafbff; }
    .agenda-grid-table .time-label { font-size: 10px; color: var(--muted); text-align: right; padding: 2px 6px; width: 50px; border-bottom: 1px solid var(--line); }
    .agenda-appt-card { position: absolute; left: 2px; right: 2px; border-radius: 5px; padding: 3px 6px; font-size: 11px; cursor: pointer; overflow: hidden; border-left: 3px solid; box-shadow: 0 1px 3px rgba(0,0,0,.1); transition: box-shadow .12s; }
    .agenda-appt-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.18); z-index: 3; }
    .agenda-appt-card .appt-time { font-weight: 700; font-size: 10px; }
    .agenda-appt-card .appt-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .agenda-appt-card .appt-client { color: var(--muted); font-size: 10px; }
    .PROF_COLOR_0 { background: #dbeafe; border-left-color: #2563eb; color: #1e40af; }
    .PROF_COLOR_1 { background: #dcfce7; border-left-color: #16a34a; color: #166534; }
    .PROF_COLOR_2 { background: #f3e8ff; border-left-color: #9333ea; color: #6b21a8; }
    .PROF_COLOR_3 { background: #fff7ed; border-left-color: #ea580c; color: #9a3412; }
    .PROF_COLOR_4 { background: #fce7f3; border-left-color: #db2777; color: #9d174d; }
    .PROF_COLOR_5 { background: #e0f2fe; border-left-color: #0284c7; color: #0c4a6e; }
    .agenda-grid-table th.unavailable { background: #fef2f2; color: #dc2626; }
    .agenda-grid-table td.unavailable { background: #fef2f2; position: relative; }
    .agenda-grid-table td.unavailable::after { content: "✕"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fca5a5; font-size: 24px; font-weight: 700; pointer-events: none; z-index: 0; }
    .agenda-grid-table td.unavailable .agenda-appt-card { display: block; z-index: 1; }

    /* === 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;
    }
    .admin-subtab-bar {
      display: flex;
      gap: 4px;
      margin-top: 8px;
    }
    .admin-subtab-btn {
      background: transparent;
      border: 1px solid var(--line);
      color: var(--muted);
      padding: 6px 16px;
      border-radius: 6px;
      font-size: 13px;
      cursor: pointer;
    }
    .admin-subtab-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;
    }.sim-node-edit-btn {
  position: absolute; top: 2px; right: 2px;
  width: 22px; height: 22px;
  border: none; border-radius: 999px;
  background: #25d366; color: #fff;
  font-size: 12px; line-height: 22px;
  text-align: center; cursor: pointer;
  z-index: 5; opacity: 0.6;
  transition: opacity .2s; padding: 0;
}
.sim-node-edit-btn:hover { opacity: 1; }
.sim-node-edit-shell { position: relative; display: block; }

    .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;
      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; }
    .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);
    }
    .profile-actions {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      flex-shrink: 0;
      justify-content: flex-end;
    }
    .profile-action-btn {
      min-height: 38px;
      padding: 9px 14px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 700;
      gap: 6px;
      box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
    }
    .profile-action-btn.btn-neutral {
      background: #475569;
      border-color: #475569;
      color: #fff;
    }
    .pdv-panel-shell {
      display: grid;
      gap: 18px;
    }
    .pdv-toolbar {
      display:flex;
      gap:12px;
      flex-wrap:wrap;
      align-items:flex-start;
      justify-content:space-between;
    }
    .pdv-tabbar {
      display:flex;
      gap:8px;
      flex-wrap:wrap;
    }
    .pdv-tab-btn {
      border:1px solid var(--line);
      background:#fff;
      color:#334155;
      border-radius:999px;
      min-height:48px;
      padding:12px 18px;
      font-size:14px;
      font-weight:700;
      cursor:pointer;
      box-shadow:0 2px 8px rgba(15,23,42,0.06);
    }
    .pdv-tab-btn.active {
      background:#16a34a;
      color:#fff;
      border-color:#16a34a;
    }
    .pdv-tab-btn:disabled {
      cursor:default;
      opacity:1;
      transform:none;
    }
    .pdv-grid {
      display:grid;
      grid-template-columns:1fr;
      gap:16px;
    }
    .pdv-checkout-column {
      position:relative;
    }
    .pdv-column {
      display:grid;
      gap:16px;
      align-content:start;
    }
    .pdv-mobile-sheet-head,
    .pdv-mobile-cartbar,
    .pdv-mobile-sheet-overlay {
      display:none;
    }
    .pdv-mobile-sheet-scroll {
      display:grid;
      gap:16px;
    }
    .pdv-card {
      background:#fff;
      border:1px solid var(--line);
      border-radius:16px;
      padding:16px;
      box-shadow:0 8px 24px rgba(15,23,42,0.04);
    }
    .pdv-card h3 {
      margin:0 0 12px;
      font-size:16px;
    }
    .pdv-card-subtitle {
      margin:-6px 0 12px;
      color:var(--muted);
      font-size:13px;
      line-height:1.45;
    }
    .pdv-search-input,
    .pdv-text-input,
    .pdv-number-input,
    .pdv-select,
    .pdv-textarea {
      width:100%;
      border:1px solid var(--line);
      border-radius:12px;
      min-height:48px;
      padding:13px 14px;
      font-size:14px;
      box-sizing:border-box;
      background:#fff;
    }
    .pdv-textarea {
      min-height:110px;
      resize:vertical;
      font-family:inherit;
    }
    .pdv-products {
      display:grid;
      gap:14px;
    }
    .pdv-product-card {
      border:1px solid #e2e8f0;
      border-radius:14px;
      overflow:hidden;
      background:#fff;
      display:grid;
      gap:0;
    }
    .pdv-product-media {
      aspect-ratio: 16 / 10;
      background:linear-gradient(135deg,#f8fafc,#e2e8f0);
      overflow:hidden;
    }
    .pdv-product-media img {
      width:100%;
      height:100%;
      object-fit:cover;
      display:block;
    }
    .pdv-product-content {
      padding:14px;
      display:grid;
      gap:10px;
    }
    .pdv-product-title {
      font-size:16px;
      font-weight:800;
      color:#0f172a;
      line-height:1.3;
    }
    .pdv-product-line {
      font-size:12px;
      color:#166534;
      font-weight:700;
      text-transform:uppercase;
      letter-spacing:.04em;
    }
    .pdv-product-description {
      font-size:13px;
      color:#475569;
      line-height:1.5;
    }
    .pdv-product-price {
      font-size:16px;
      font-weight:800;
      color:#0f172a;
    }
    .pdv-variant-list {
      display:grid;
      gap:8px;
    }
    .pdv-variant-chip {
      border:1px solid #cbd5e1;
      background:#f8fafc;
      border-radius:12px;
      padding:12px;
      display:flex;
      justify-content:space-between;
      align-items:center;
      gap:8px;
      font-size:13px;
      font-weight:700;
      flex-wrap:wrap;
    }
    .pdv-add-btn,
    .pdv-outline-btn,
    .pdv-danger-btn {
      border:none;
      border-radius:12px;
      min-height:48px;
      padding:12px 16px;
      font-size:14px;
      font-weight:800;
      cursor:pointer;
      transition:transform 0.15s ease, box-shadow 0.15s ease;
    }
    .pdv-add-btn { background:#16a34a; color:#fff; }
    .pdv-outline-btn { background:#fff; color:#0f172a; border:1px solid var(--line); }
    .pdv-danger-btn { background:#dc2626; color:#fff; }
    .pdv-add-btn:hover,
    .pdv-outline-btn:hover,
    .pdv-danger-btn:hover {
      transform:translateY(-1px);
      box-shadow:0 8px 18px rgba(15,23,42,0.08);
    }
    .pdv-cart-list,
    .pdv-sales-list,
    .pdv-customer-results {
      display:grid;
      gap:10px;
    }
    .pdv-cart-item,
    .pdv-sale-card,
    .pdv-customer-card {
      border:1px solid #e2e8f0;
      border-radius:14px;
      padding:14px;
      background:#fff;
    }
    .pdv-cart-item-top,
    .pdv-sale-card-top,
    .pdv-customer-card-top {
      display:flex;
      justify-content:space-between;
      align-items:flex-start;
      gap:10px;
    }
    .pdv-qty-controls {
      display:inline-flex;
      align-items:center;
      gap:8px;
      border:1px solid #cbd5e1;
      border-radius:999px;
      padding:4px 6px;
      background:#f8fafc;
    }
    .pdv-qty-btn {
      width:38px;
      height:38px;
      border:none;
      border-radius:50%;
      background:#fff;
      font-size:18px;
      font-weight:900;
      line-height:1;
      color:#0f172a;
      cursor:pointer;
      box-shadow:0 2px 6px rgba(15,23,42,0.08);
      display:flex;
      align-items:center;
      justify-content:center;
      text-align:center;
    }
    .pdv-qty-btn:hover {
      background:#eff6ff;
      color:#1d4ed8;
    }
    .pdv-qty-value {
      min-width:28px;
      text-align:center;
      font-weight:800;
      color:#0f172a;
      font-size:15px;
    }
    .pdv-toggle-group {
      display:grid;
      grid-template-columns:1fr;
      gap:8px;
    }
    .pdv-toggle-option {
      border:1px solid #cbd5e1;
      border-radius:12px;
      min-height:52px;
      padding:14px 12px;
      background:#fff;
      font-size:14px;
      cursor:pointer;
      text-align:left;
      font-weight:700;
      color:#0f172a;
    }
    .pdv-toggle-option.active {
      border-color:#16a34a;
      background:#f0fdf4;
      color:#166534;
    }
    .pdv-payment-grid {
      display:grid;
      grid-template-columns:repeat(2, minmax(0,1fr));
      gap:8px;
    }
    .pdv-payment-btn {
      border:1px solid #cbd5e1;
      background:#fff;
      border-radius:12px;
      min-height:52px;
      font-size:14px;
      font-weight:800;
      cursor:pointer;
      color:#0f172a;
      padding:10px 12px;
    }
    .pdv-payment-btn.active {
      border-color:#2563eb;
      background:#eff6ff;
      color:#1d4ed8;
    }
    .pdv-summary-row {
      display:flex;
      justify-content:space-between;
      gap:10px;
      font-size:14px;
      color:#334155;
      margin-bottom:10px;
      align-items:center;
    }
    .pdv-summary-row.total {
      padding-top:10px;
      border-top:1px solid #e2e8f0;
      font-size:17px;
      font-weight:800;
      color:#0f172a;
    }
    .pdv-sticky-cta {
      position:sticky;
      bottom:8px;
      z-index:10;
      background:#ffffff;
      border:1px solid rgba(203, 213, 225, 0.92);
      box-shadow:0 18px 34px rgba(15, 23, 42, 0.12);
      padding-top:14px;
      padding-bottom:calc(8px + env(safe-area-inset-bottom, 0px));
      isolation:isolate;
    }
    .pdv-detail-grid {
      display:grid;
      gap:10px;
      grid-template-columns:1fr;
    }
    .pdv-detail-block {
      border:1px solid #e2e8f0;
      border-radius:12px;
      padding:12px;
      background:#f8fafc;
    }
    .pdv-detail-block h4 {
      margin:0 0 8px;
      font-size:13px;
      text-transform:uppercase;
      letter-spacing:.04em;
      color:#475569;
    }
    .pdv-detail-item {
      display:flex;
      justify-content:space-between;
      gap:12px;
      font-size:13px;
      padding:4px 0;
      border-bottom:1px solid rgba(203,213,225,0.6);
    }
    .pdv-detail-item:last-child {
      border-bottom:none;
    }
    .pdv-empty {
      color:var(--muted);
      font-size:13px;
      text-align:center;
      padding:18px 10px;
      border:1px dashed #cbd5e1;
      border-radius:12px;
      background:#f8fafc;
    }
    .pdv-hidden {
      display:none !important;
    }
    body.pdv-mobile-sheet-lock {
      overflow:hidden;
    }
    @media (max-width: 767px) {
      #panel-pdv .panel-body {
        padding: 14px 12px calc(108px + env(safe-area-inset-bottom, 0px));
      }
      .pdv-panel-shell {
        gap: 14px;
      }
      .pdv-toolbar {
        position: sticky;
        top: 0;
        z-index: 12;
        margin: -14px -12px 0;
        padding: 12px;
        background: rgba(241, 245, 249, 0.96);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(203, 213, 225, 0.8);
      }
      .pdv-toolbar > div:first-child {
        width: 100%;
      }
      .pdv-tabbar {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .pdv-tab-btn {
        width: 100%;
        justify-content: center;
      }
      .pdv-card {
        padding: 14px;
        border-radius: 14px;
      }
      .pdv-checkout-column {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 30;
        max-height: calc(100vh - 84px);
        padding: 0;
        gap: 0;
        border: 1px solid rgba(203, 213, 225, 0.92);
        border-radius: 24px;
        background: #fff;
        box-shadow: 0 -20px 40px rgba(15, 23, 42, 0.24);
        overflow: hidden;
        transform: translateY(calc(100% + 24px));
        opacity: 0;
        pointer-events: none;
        transition: transform 0.22s ease, opacity 0.22s ease;
      }
      #panel-pdv.pdv-mobile-sheet-open .pdv-checkout-column {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
      }
      .pdv-mobile-sheet-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.3);
        backdrop-filter: blur(2px);
        z-index: 26;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
      }
      #panel-pdv.pdv-mobile-sheet-open .pdv-mobile-sheet-overlay {
        opacity: 1;
        pointer-events: auto;
      }
      .pdv-mobile-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 14px 10px;
        border-bottom: 1px solid rgba(226, 232, 240, 0.95);
        background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.96));
      }
      .pdv-mobile-sheet-kicker {
        font-size: 11px;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: .04em;
        margin-bottom: 4px;
      }
      .pdv-mobile-sheet-scroll {
        display: grid;
        gap: 14px;
        flex: 1;
        min-height: 0;
        padding: 14px;
        overflow: auto;
        overscroll-behavior: contain;
      }
      .pdv-mobile-cartbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 24;
        padding: 12px 14px;
        border: 1px solid rgba(203, 213, 225, 0.96);
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
        backdrop-filter: blur(12px);
      }
      .pdv-mobile-cartbar.pdv-hidden {
        display: none !important;
      }
      #panel-pdv.pdv-mobile-sheet-open .pdv-mobile-cartbar {
        opacity: 0;
        pointer-events: none;
        transform: translateY(12px);
      }
      .pdv-mobile-cartbar-meta {
        min-width: 0;
        flex: 1;
      }
      .pdv-mobile-cartbar-kicker {
        font-size: 11px;
        color: #475569;
        text-transform: uppercase;
        letter-spacing: .04em;
        margin-bottom: 4px;
      }
      .pdv-mobile-cartbar-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        color: #0f172a;
        font-size: 14px;
      }
      .pdv-mobile-cartbar-main strong {
        min-width: 0;
        font-size: 15px;
      }
      .pdv-mobile-cartbar-main span {
        font-weight: 800;
        white-space: nowrap;
      }
      #pdvMobileCartBarBtn,
      #pdvMobileCloseBtn {
        min-height: 44px;
        padding: 10px 14px;
        white-space: nowrap;
      }
      .pdv-products {
        grid-template-columns: 1fr;
      }
      .pdv-product-media {
        aspect-ratio: 16 / 9;
      }
      .pdv-variant-chip {
        align-items: stretch;
      }
      .pdv-variant-chip .pdv-add-btn {
        width: 100%;
      }
      .pdv-cart-item-top,
      .pdv-sale-card-top,
      .pdv-customer-card-top {
        flex-direction: column;
        align-items: stretch;
      }
      .pdv-qty-controls {
        width: 100%;
        justify-content: space-between;
      }
      .pdv-summary-row {
        font-size: 15px;
      }
      .pdv-sticky-cta {
        bottom: 0;
        margin: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        box-shadow: 0 -16px 32px rgba(15, 23, 42, 0.16);
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
      }
      .pdv-sticky-cta h3 {
        margin-bottom: 8px;
      }
      #pdvSubmitBtn {
        min-height: 54px;
        font-size: 15px;
      }
    }
    @media (min-width: 768px) and (max-width: 1023px) {
      #panel-pdv .panel-body {
        padding: 18px;
      }
      .pdv-grid {
        grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
        align-items: start;
      }
      .pdv-products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .pdv-toggle-group {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }
      .pdv-payment-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }
      .pdv-sticky-cta {
        bottom: 10px;
      }
    }
    @media (min-width: 1024px) {
      .pdv-grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
        align-items:start;
      }
      .pdv-products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .pdv-toggle-group {
        grid-template-columns: repeat(3, minmax(0,1fr));
      }
      .pdv-detail-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
      }
    }
    .badge-status {
      display: inline-block;
      font-size: 11px;
      font-weight: 700;
      padding: 2px 10px;
      border-radius: 12px;
      text-transform: uppercase;
    }
    .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: 2200px;
      opacity: 1;
    }
    .badge-pending   { background: #fef9c3; color: #854d0e; }
    .badge-payment   { background: #dbeafe; color: #1d4ed8; }
    .badge-confirmed { background: #dcfce7; color: #166534; }
    .badge-progress  { background: #ede9fe; color: #6d28d9; }
    .badge-ready     { background: #ffedd5; color: #c2410c; }
    .badge-shipping  { background: #e0f2fe; color: #0369a1; }
    .badge-done      { background: #e2e8f0; color: #334155; }
    .badge-cancelled { background: #fee2e2; color: #991b1b; }
    .badge-open      { background: #dbeafe; color: #1e40af; }
    .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; }
    }
