:root {
      --bg: #0f1419;
      --surface: #1a2332;
      --border: #2d3a4d;
      --text: #e6edf3;
      --text-muted: #8b949e;
      --accent: #58a6ff;
      --accent-hover: #79b8ff;
      --success: #3fb950;
      --danger: #f85149;
      --radius: 8px;
      --font: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    }
    * { box-sizing: border-box; }
    html, body {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      min-height: 100%;
      overflow: hidden;
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      font-size: 14px;
      line-height: 1.5;
    }
    .app {
      width: 100%;
      height: 100%;
      min-height: 100vh;
      max-width: none;
      margin: 0;
      padding: 1rem 1.5rem;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    h1 {
      font-size: 1.25rem;
      font-weight: 600;
      margin: 0 0 1rem;
      color: var(--text);
    }
    .tabs {
      display: flex;
      gap: 0.25rem;
      margin-bottom: 1rem;
      border-bottom: 1px solid var(--border);
    }
    .tabs button {
      background: none;
      border: none;
      color: var(--text-muted);
      padding: 0.5rem 1rem;
      cursor: pointer;
      font-family: inherit;
      font-size: 0.9rem;
      border-bottom: 2px solid transparent;
      margin-bottom: -1px;
    }
    .tabs button:hover { color: var(--text); }
    .tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
    .tabs { flex-shrink: 0; }
    .app-nav { display: flex; gap: 0; margin-bottom: 1rem; border-bottom: 1px solid var(--border); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .app-nav::-webkit-scrollbar { display: none; }
    .app-nav a { color: var(--text-muted); padding: 0.5rem 0.85rem; font-family: inherit; font-size: 0.88rem; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
    .app-nav a:hover { color: var(--text); }
    .app-nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
    .workflow-page { flex: 1 1 0%; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
    .panel {
      display: none;
      flex: 1;
      min-height: 0;
      overflow: hidden;
      flex-direction: column;
      -webkit-overflow-scrolling: touch;
    }
    .panel.active {
      display: flex;
      flex: 1 1 0%;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }
    /* Scrollable content wrapper for non-workflow panels */
    .panel-content-wrap {
      flex: 1 1 0;
      min-height: 0;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      padding: 0 0 1rem 0;
      display: block;
    }
    /* Ensure direct child of these panels fills and scrolls when panel is active */
    #panel-monitor.active > .panel-content-wrap,
    #panel-stats.active > .panel-content-wrap,
    #panel-guide.active > .panel-content-wrap,
    #panel-admin.active > .panel-content-wrap {
      flex: 1 1 0;
      min-height: 0;
      overflow: auto;
      display: block;
    }
    /* Guide and Admin: block layout with explicit height so content is always visible */
    #panel-guide.active,
    #panel-admin.active {
      display: block !important;
      min-height: 70vh;
      height: auto;
    }
    #panel-guide.active > .panel-content-wrap,
    #panel-admin.active > .panel-content-wrap {
      display: block !important;
      height: 70vh;
      min-height: 400px;
      overflow-y: auto;
      overflow-x: hidden;
      visibility: visible !important;
      -webkit-overflow-scrolling: touch;
    }
    #panel-guide.active .guide-content,
    #panel-guide.active .collapsible-mobile-content,
    #panel-guide.active details.collapsible-mobile {
      display: block !important;
      visibility: visible;
    }
    #panel-guide.active details.collapsible-mobile { border: none; background: transparent; }
    #panel-admin.active .admin-panel-inner {
      display: block !important;
      visibility: visible;
      min-height: 200px;
    }
    .toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      align-items: center;
      margin-bottom: 1rem;
    }
    select {
      background: var(--surface);
      color: var(--text);
      border: 1px solid var(--border);
      padding: 0.4rem 0.75rem;
      border-radius: var(--radius);
      font-family: inherit;
      font-size: 0.9rem;
      min-width: 160px;
    }
    select:focus { outline: none; border-color: var(--accent); }
    .btn {
      background: var(--accent);
      color: var(--bg);
      border: none;
      padding: 0.45rem 0.9rem;
      border-radius: var(--radius);
      font-family: inherit;
      font-size: 0.9rem;
      cursor: pointer;
      font-weight: 500;
    }
    .btn:hover { background: var(--accent-hover); }
    a.btn { text-decoration: none; display: inline-block; }
    .btn.secondary {
      background: var(--surface);
      color: var(--text);
      border: 1px solid var(--border);
    }
    .btn.secondary:hover { background: var(--border); }
    .btn.danger { background: var(--danger); color: #fff; }
    .btn.success { background: var(--success); color: #fff; }
    .btn.success:hover { background: #2ea043; }
    #workflow-save { background: var(--success); color: #fff; font-weight: 600; }
    #workflow-save:hover { background: #2ea043; }
    .recordings-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 0.75rem;
    }
    .rec-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 0.75rem;
      display: flex;
      align-items: flex-start;
      gap: 0.5rem;
    }
    .rec-card .play {
      flex-shrink: 0;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: var(--accent);
      color: var(--bg);
      border: none;
      cursor: pointer;
      font-size: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.15s;
    }
    .rec-card .play:hover { transform: scale(1.05); }
    .rec-card .play.playing { background: var(--success); }
    .rec-card .actions { flex-shrink: 0; display: flex; align-items: center; gap: 0.25rem; }
    .rec-card .copy-btn {
      width: 32px; height: 32px; border-radius: var(--radius);
      background: var(--surface); border: 1px solid var(--border);
      color: var(--text-muted); cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      font-size: 0.9rem; transition: color 0.15s, border-color 0.15s;
    }
    .rec-card .copy-btn:hover { color: var(--accent); border-color: var(--accent); }
    .rec-card .copy-btn.copied { color: var(--success); }
    .rec-card .info { flex: 1; min-width: 0; }
    .rec-card .name { font-weight: 500; word-break: break-word; }
    .rec-card .path { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
    .rec-card .text { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; line-height: 1.4; }
    .rec-group { margin-bottom: 1.25rem; }
    .rec-group-title {
      font-size: 0.85rem; font-weight: 600; color: var(--accent);
      margin-bottom: 0.5rem; padding-bottom: 0.25rem;
      border-bottom: 1px solid var(--border);
    }
    .rec-group .recordings-grid { margin-top: 0.25rem; }
    .campaign-layout {
      display: grid;
      grid-template-columns: 1fr 320px;
      gap: 1rem;
    }
    @media (max-width: 900px) { .campaign-layout { grid-template-columns: 1fr; } }
    .yaml-editor {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem;
    }
    .yaml-editor textarea {
      width: 100%;
      min-height: 420px;
      background: var(--bg);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 0.75rem;
      font-family: var(--font);
      font-size: 0.85rem;
      line-height: 1.5;
      resize: vertical;
    }
    .yaml-editor textarea:focus { outline: none; border-color: var(--accent); }
    .sidebar {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem;
      height: fit-content;
    }
    .sidebar h3 { margin: 0 0 0.75rem; font-size: 0.95rem; }
    .sidebar .rec-list {
      max-height: 380px;
      overflow-y: auto;
    }
    .sidebar .rec-group-title {
      font-size: 0.8rem; font-weight: 600; color: var(--accent);
      margin-top: 0.6rem; margin-bottom: 0.25rem;
      padding-bottom: 0.2rem; border-bottom: 1px solid var(--border);
    }
    .sidebar .rec-group-title:first-child { margin-top: 0; }
    .sidebar .rec-item {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.35rem 0;
      border-bottom: 1px solid var(--border);
      cursor: pointer;
      font-size: 0.85rem;
    }
    .sidebar .rec-item:hover { color: var(--accent); }
    .sidebar .rec-item .play-mini {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: var(--border);
      border: none;
      color: var(--text);
      cursor: pointer;
      font-size: 0.7rem;
      flex-shrink: 0;
    }
    .sidebar .rec-item .play-mini:hover { background: var(--accent); color: var(--bg); }
    .sidebar .rec-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sidebar .rec-item .copy-btn {
      width: 26px; height: 26px; border-radius: 4px;
      background: transparent; border: none; color: var(--text-muted);
      cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
      font-size: 0.85rem; opacity: 0.7;
    }
    .sidebar .rec-item .copy-btn:hover { color: var(--accent); opacity: 1; }
    .sidebar .rec-item .copy-btn.copied { color: var(--success); }
    .msg {
      padding: 0.5rem 0.75rem;
      border-radius: var(--radius);
      margin-bottom: 0.75rem;
    }
    .msg.success { background: rgba(63, 185, 80, 0.15); color: var(--success); }
    .msg.error { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
    .empty { color: var(--text-muted); padding: 1rem; text-align: center; }
    audio { display: none; }
    /* Guide */
    .guide-content { max-width: 720px; line-height: 1.6; display: block; }
    #panel-guide .collapsible-mobile-content,
    #panel-monitor .collapsible-mobile-content,
    #panel-stats .collapsible-mobile-content { display: block; }
    .guide-content h2 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; color: var(--accent); }
    .guide-content h2:first-child { margin-top: 0; }
    .guide-content p { margin: 0.35rem 0; color: var(--text-muted); }
    .guide-content code, .guide-content pre { background: var(--surface); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }
    .guide-content pre { padding: 0.75rem; overflow-x: auto; margin: 0.5rem 0; white-space: pre-wrap; }
    .guide-content ul { margin: 0.35rem 0; padding-left: 1.25rem; color: var(--text-muted); }
    /* Form builder */
    .form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
    .form-section h3 { margin: 0 0 0.75rem; font-size: 0.95rem; }
    .form-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-bottom: 0.5rem; }
    .form-row label { min-width: 100px; color: var(--text-muted); font-size: 0.9rem; }
    .form-row input[type="text"], .form-row input[type="number"] {
      background: var(--bg); color: var(--text); border: 1px solid var(--border);
      padding: 0.35rem 0.5rem; border-radius: var(--radius); font-family: inherit; font-size: 0.9rem;
    }
    .form-row input:focus { outline: none; border-color: var(--accent); }
    .state-row { display: grid; grid-template-columns: 100px 80px 1fr 1fr auto; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; font-size: 0.85rem; }
    .state-row.head { color: var(--text-muted); font-weight: 600; }
    .state-row input, .state-row select { padding: 0.25rem 0.4rem; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px; font-family: inherit; }
    .form-generated { margin-top: 1rem; }
    .form-generated textarea { width: 100%; min-height: 320px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; font-family: var(--font); font-size: 0.8rem; line-height: 1.4; resize: vertical; }
    .form-generated .actions { margin-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
    /* Visual Workflow */
    .workflow-layout { display: grid; grid-template-columns: 180px 1fr 280px; gap: 0; flex: 1; min-height: 0; height: 100%; }
    @media (max-width: 1100px) { .workflow-layout { grid-template-columns: 180px 1fr; } }
    .workflow-palette {
      background: var(--surface);
      border: 1px solid var(--border);
      border-right: none;
      border-radius: var(--radius) 0 0 var(--radius);
      padding: 0.75rem;
      overflow-y: auto;
    }
    .workflow-palette h3 { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--accent); }
    .workflow-palette .node-type {
      padding: 0.5rem 0.6rem;
      margin-bottom: 0.35rem;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      cursor: grab;
      font-size: 0.8rem;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    .workflow-palette .node-type:hover { border-color: var(--accent); color: var(--accent); }
    .workflow-palette .node-type .icon { font-size: 1rem; }
    .canvas-hint {
      padding: 0.5rem 0.75rem;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      font-size: 0.8rem;
      color: var(--text-muted);
      line-height: 1.4;
    }
    .canvas-hint-text { display: block; }
    .canvas-resize-handle {
      height: 6px;
      background: var(--border);
      cursor: ns-resize;
      flex-shrink: 0;
      border-radius: 2px;
      margin: 2px 0;
    }
    .canvas-resize-handle:hover { background: var(--accent); }
    .workflow-canvas-wrap {
      border: 1px solid var(--border);
      border-radius: 0 var(--radius) var(--radius) 0;
      background: #0d1117;
      position: relative;
      overflow: visible;
      min-height: 320px;
      height: 420px;
      display: flex;
      flex-direction: column;
    }
    .workflow-canvas-wrap #drawflow-container { flex: 1; min-height: 0; }
    #drawflow-container { width: 100%; height: 100%; min-height: 400px; position: relative; }
    /* Inner canvas must have size so connection SVGs and nodes render */
    .parent-drawflow .drawflow { width: 100%; height: 100%; min-height: 400px; position: absolute; top: 0; left: 0; overflow: visible; }
    .parent-drawflow .drawflow-node { position: absolute; visibility: visible !important; opacity: 1 !important; }
    .app-header {
      display: flex; align-items: center; gap: 1.5rem;
      padding-bottom: 0.75rem; margin-bottom: 0.75rem;
      border-bottom: 1px solid var(--border);
      flex-wrap: nowrap; flex-shrink: 0;
      position: sticky; top: 0; z-index: 20;
      background: var(--bg);
    }
    .app-title { font-size: 1.1rem; font-weight: 600; margin: 0; color: var(--text); white-space: nowrap; }
    .app-header .app-nav { margin-bottom: 0; border-bottom: none; flex: 1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .app-header .app-nav::-webkit-scrollbar { display: none; }
    .app-header .app-nav a { white-space: nowrap; }
    .nav-signout { margin-left: auto; white-space: nowrap; }
    .workflow-toolbar-bar { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.75rem; flex-shrink: 0; }
    .toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
    .toolbar-row-primary { flex-wrap: wrap; align-items: center; }
    .toolbar-group { display: flex; align-items: center; gap: 0.35rem; }
    .toolbar-group.toolbar-labeled { flex-direction: row; align-items: center; }
    .toolbar-group.toolbar-labeled .toolbar-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-right: 0.25rem; white-space: nowrap; }
    .toolbar-divider { width: 1px; height: 1.8rem; background: var(--border); margin: 0 0.25rem; flex-shrink: 0; }
    .toolbar-group select { min-width: 160px; }
    .toolbar-row-secondary { margin-top: 0.15rem; }
    .toolbar-input { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 0.35rem 0.5rem; border-radius: var(--radius); font-family: inherit; font-size: 0.85rem; }
    .toolbar-input:focus { outline: none; border-color: var(--accent); }
    .toolbar-spacer { flex: 1; min-width: 1rem; }
    .toolbar-actions { gap: 0.35rem; }
    .workflow-msg {
      font-size: 0.85rem;
      margin-left: 0.5rem;
      max-width: min(42rem, 100%);
      white-space: pre-wrap;
      word-break: break-word;
      line-height: 1.35;
    }
    .settings-dropdown { position: relative; display: inline-block; }
    .settings-dropdown summary { list-style: none; cursor: pointer; }
    .settings-dropdown summary::-webkit-details-marker { display: none; }
    .settings-panel {
      position: absolute; top: 100%; right: 0; margin-top: 0.35rem; min-width: 320px; max-width: 420px; max-height: 75vh;
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
      padding: 1rem; overflow-y: auto; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    }
    .settings-section { margin-bottom: 1rem; }
    .settings-section:last-of-type { margin-bottom: 0.75rem; }
    .settings-section h4 { font-size: 0.85rem; margin: 0 0 0.5rem; color: var(--accent); }
    .settings-section .form-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
    .settings-section .form-row label { min-width: 6rem; font-size: 0.8rem; color: var(--text-muted); }
    .settings-section .form-row input, .settings-section .form-row select { flex: 1; min-width: 120px; }
    .settings-section .yaml-preview { font-size: 0.75rem; max-height: 180px; overflow: auto; background: var(--bg); padding: 0.5rem; border-radius: 4px; white-space: pre-wrap; word-break: break-all; }
    .settings-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding-top: 0.75rem; border-top: 1px solid var(--border); }
    .realtime-label { font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }
    .realtime-label input { cursor: pointer; }
    .settings-actions .btn, .settings-actions a.btn { text-decoration: none; }
    .workflow-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 0.75rem; }
    .workflow-toolbar .btn { flex-shrink: 0; }
    .workflow-toolbar-group { display: flex; align-items: center; gap: 0.35rem; }
    .workflow-toolbar-group select { min-width: 180px; }
    .workflow-toolbar-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-right: 0.25rem; white-space: nowrap; }
    .workflow-toolbar-actions { display: flex; gap: 0.35rem; align-items: center; }
    .btn.icon-btn { padding: 0.4rem 0.6rem; font-size: 1rem; line-height: 1; min-width: 32px; }
    .workflow-actions-details .collapsible-mobile-content { padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 0.35rem; }
    .canvas-hint { padding: 0.6rem 0.85rem; background: rgba(88, 166, 255, 0.08); border: 1px solid rgba(88, 166, 255, 0.2); border-radius: var(--radius); margin-bottom: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
    .canvas-hint strong { color: var(--accent); }
    /* Drawflow overrides for dark theme; ensure connection points are clickable/draggable */
    .drawflow .drawflow-node { background: var(--surface) !important; border: 1px solid var(--border) !important; color: var(--text) !important; border-radius: var(--radius) !important; min-width: 110px; }
    .drawflow .drawflow-node.selected { border-color: var(--accent) !important; box-shadow: 0 0 0 2px rgba(88,166,255,0.3); }
    .drawflow .drawflow-node .input,
    .drawflow .drawflow-node .output {
      background: var(--accent) !important;
      z-index: 5;
      pointer-events: auto !important;
      cursor: crosshair;
      touch-action: none;
    }
    .drawflow .drawflow-node .inputs,
    .drawflow .drawflow-node .outputs { pointer-events: none; }
    .drawflow .drawflow-node .inputs .input,
    .drawflow .drawflow-node .outputs .output { pointer-events: auto !important; }
    .drawflow .drawflow-content,
    .drawflow .drawflow_content_node { padding: 0.3rem 0.45rem; font-size: 0.75rem; }
    /* Connection lines: Drawflow appends SVG.connection to .drawflow (not inside nodes). Ensure visible and on top. */
    .drawflow .connection {
      position: absolute !important;
      top: 0 !important;
      left: 0 !important;
      width: 100% !important;
      height: 100% !important;
      pointer-events: none;
      z-index: 1;
    }
    .drawflow .connection .main-path {
      stroke: var(--accent) !important;
      stroke-width: 5px !important;
      fill: none !important;
      pointer-events: all !important;
      visibility: visible !important;
    }
    .drawflow .connection .main-path:hover { stroke: var(--accent-hover) !important; }
    .drawflow .connection .main-path.selected { stroke: var(--success) !important; }
    /* Legacy selectors in case connection was ever inside node */
    .drawflow .drawflow-node .outputs .output .connection .main-path,
    .drawflow .drawflow-node .inputs .input .connection .main-path { stroke: var(--accent) !important; }
    @media (hover: none) and (pointer: coarse) {
      .drawflow .connection .main-path { stroke-width: 6px !important; }
    }
    .drawflow .drawflow-node.node-play { border-left: 3px solid var(--accent); }
    .drawflow .drawflow-node.node-ask { border-left: 3px solid #a371f7; }
    .drawflow .drawflow-node.node-transfer { border-left: 3px solid var(--success); }
    .drawflow .drawflow-node.node-hangup { border-left: 3px solid var(--danger); }
    .drawflow .drawflow-node.node-disposition { border-left: 3px solid #d29922; }
    .drawflow .drawflow-node.node-converse { border-left: 3px solid #39d353; }
    .node-state-name { font-weight: 600; margin-bottom: 0.15rem; font-size: 0.78rem; }
    .node-state-audio { font-size: 0.7rem; color: var(--text-muted); }
    .node-state-outputs { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.1rem; }
    .workflow-sidebar {
      background: var(--surface);
      border: 1px solid var(--border);
      border-left: none;
      border-radius: 0 var(--radius) var(--radius) 0;
      padding: 0.75rem;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }
    @media (max-width: 1100px) { .workflow-sidebar { display: none; } }
    .workflow-sidebar h3 { margin: 0 0 0.35rem; font-size: 0.85rem; color: var(--accent); }
    .workflow-rec-list { max-height: 200px; overflow-y: auto; font-size: 0.8rem; }
    .workflow-rec-item {
      display: flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0;
      border-bottom: 1px solid var(--border); cursor: pointer;
    }
    .workflow-rec-item:hover { color: var(--accent); }
    .workflow-rec-item .play-mini {
      width: 22px; height: 22px; border-radius: 50%; background: var(--border); border: none;
      color: var(--text); cursor: pointer; font-size: 0.65rem; flex-shrink: 0;
    }
    .workflow-rec-item .play-mini:hover { background: var(--accent); color: var(--bg); }
    .workflow-rec-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .node-editor-panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; }
    .node-editor-panel h3 { margin: 0; font-size: 0.85rem; }
    .node-editor-panel .field { margin-bottom: 0.5rem; }
    .node-editor-panel label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.2rem; }
    .node-editor-panel input, .node-editor-panel select {
      width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border);
      padding: 0.35rem 0.5rem; border-radius: 4px; font-size: 0.85rem; font-family: inherit;
    }
    .node-editor-panel textarea { font-family: inherit; font-size: 0.82rem; }
    .node-editor-panel .play-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.35rem; }
    .node-editor-panel .play-node-btn {
      width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--bg);
      border: none; cursor: pointer; font-size: 0.9rem; flex-shrink: 0;
    }
    .node-editor-panel .play-node-btn:hover { opacity: 0.9; }
    .node-editor-panel .play-node-btn.playing { background: var(--success); }
    .rec-upload-zone {
      border: 2px dashed var(--border); border-radius: var(--radius); padding: 1rem; text-align: center;
      color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.75rem; cursor: pointer;
    }
    .rec-upload-zone:hover { border-color: var(--accent); color: var(--accent); }
    .rec-upload-zone input { display: none; }
    .rec-manage-item { display: flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
    .rec-manage-item .del-btn { margin-left: auto; padding: 0.2rem 0.4rem; font-size: 0.75rem; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); border-radius: 4px; cursor: pointer; }
    .rec-manage-item .del-btn:hover { color: var(--danger); border-color: var(--danger); }
    .yaml-collapse-panel {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem;
      margin-bottom: 1rem;
    }
    .yaml-collapse-panel h3 { margin: 0 0 0.5rem; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; }
    .yaml-preview {
      max-height: 400px;
      overflow: auto;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 0.75rem;
      font-size: 0.8rem;
      line-height: 1.4;
      white-space: pre-wrap;
      word-break: break-all;
      margin: 0;
    }
    .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
    /* Monitor */
    .monitor-toolbar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; }
    .monitor-toolbar input[type="text"] { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 0.35rem 0.5rem; border-radius: var(--radius); font-family: inherit; font-size: 0.85rem; min-width: 180px; }
    .monitor-toolbar input[type="text"]:focus { outline: none; border-color: var(--accent); }
    .monitor-log { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; max-height: 70vh; min-height: 40vh; overflow-y: auto; font-size: 0.8rem; line-height: 1.6; }
    .monitor-event { padding: 0.15rem 0; border-bottom: 1px solid rgba(45,58,77,0.3); }
    .monitor-event .ts { color: var(--text-muted); margin-right: 0.5rem; font-size: 0.75rem; }
    .monitor-event .uuid-tag { color: #a371f7; margin-right: 0.5rem; font-size: 0.75rem; }
    .monitor-event.type-call_start { color: var(--accent); font-weight: 600; }
    .monitor-event.type-call_end { color: var(--text-muted); font-style: italic; }
    .monitor-event.type-speech_start { color: #d29922; }
    .monitor-event.type-transcription { color: var(--text); font-style: italic; }
    .monitor-event.type-intent { color: var(--success); font-weight: 600; }
    .monitor-event.type-barge_in { color: var(--danger); }
    .monitor-event.type-state_transition { color: var(--accent); }
    .monitor-event.type-timeout { color: #d29922; }
    .monitor-event.type-audio_skipped { color: var(--danger); }
    .monitor-event.type-transcription .stt-text { font-weight: 600; color: #c9d1d9; }
    .monitor-active { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; font-size: 0.85rem; }
    /* Stats */
    .stats-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
    .stats-table th, .stats-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
    .stats-table th { background: var(--bg); color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }
    .stats-table td { font-size: 0.85rem; }
    /* Validation */
    .validation-results { margin-bottom: 0.5rem; }
    .validation-msg { margin: 0.25rem 0; padding: 0.35rem 0.6rem; border-radius: var(--radius); font-size: 0.8rem; }
    .validation-msg.warning { background: rgba(210,153,34,0.15); color: #d29922; }
    .validation-msg.error { background: rgba(248,81,73,0.15); color: var(--danger); }
    .validation-msg.ok { background: rgba(63,185,80,0.15); color: var(--success); }
    /* Dry run overlay */
    .dryrun-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15,20,25,0.85); z-index: 10; display: flex; flex-direction: column; border-radius: 0 var(--radius) var(--radius) 0; }
    .dryrun-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.5rem 0.75rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
    .dryrun-log { flex: 1; overflow-y: auto; padding: 0.75rem; font-size: 0.8rem; line-height: 1.7; }
    .dryrun-step { padding: 0.15rem 0; }
    .dryrun-step.play { color: var(--accent); }
    .dryrun-step.ask { color: #a371f7; }
    .dryrun-step.transfer { color: var(--success); }
    .dryrun-step.hangup { color: var(--danger); }
    .dryrun-step.intent { color: #d29922; }
    .dryrun-step.end { color: var(--text-muted); font-style: italic; }
    .workflow-realtime-label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; color: var(--text-muted); cursor: pointer; }
    .workflow-realtime-label input { margin: 0; }
    #admin-ips-list li { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-family: monospace; }
    #admin-ips-list li:last-child { border-bottom: none; }
    /* Audio progress */
    .audio-progress-wrap { position: fixed; bottom: 0; left: 0; right: 0; height: 3px; background: var(--border); z-index: 100; display: none; }
    .audio-progress-bar { height: 100%; background: var(--accent); transition: width 0.2s linear; width: 0%; }
    /* Checkbox label */
    .check-label { display: flex; align-items: center; gap: 0.25rem; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; }
    .check-label input { margin: 0; }

    /* ——— Mobile responsive ——— */
    @media (max-width: 768px) {
      .app { padding: 0.75rem; max-width: 100%; }
      h1 { font-size: 1.1rem; margin-bottom: 0.75rem; }
      .tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 0.75rem; padding-bottom: 2px; }
      .tabs button { padding: 0.5rem 0.75rem; font-size: 0.85rem; white-space: nowrap; flex-shrink: 0; min-height: 44px; }
      .panel { padding-bottom: env(safe-area-inset-bottom, 0); }
      .btn, .btn.secondary { min-height: 44px; min-width: 44px; padding: 0.6rem 0.9rem; font-size: 0.9rem; }
      .btn-sm { min-height: 36px; padding: 0.4rem 0.65rem; }
      select, .workflow-toolbar select { min-height: 44px; min-width: 0; font-size: 0.9rem; }
      .workflow-toolbar { gap: 0.4rem; margin-bottom: 0.5rem; }
      .workflow-toolbar .btn { min-height: 44px; }
      .workflow-toolbar-secondary { display: none; flex-wrap: wrap; gap: 0.4rem; }
      .workflow-toolbar-expanded .workflow-toolbar-secondary { display: flex; }
      .workflow-more-btn { display: inline-flex !important; align-items: center; min-height: 44px; }
      .workflow-layout { grid-template-columns: 1fr; min-height: 60vh; }
      .workflow-palette {
        border: 1px solid var(--border); border-radius: var(--radius); border-bottom-left-radius: 0; border-bottom-right-radius: 0;
        padding: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
      }
      .workflow-palette h3 { margin: 0 0.25rem 0 0; font-size: 0.8rem; width: 100%; }
      .workflow-palette .node-type { margin: 0; padding: 0.5rem 0.65rem; font-size: 0.8rem; flex: 1 1 auto; min-width: 70px; }
      .workflow-palette p { display: none; }
      .workflow-canvas-wrap {
        border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius);
        min-height: 50vh; min-height: 50dvh;
      }
      #drawflow-container { min-height: 50vh; min-height: 50dvh; }
      .workflow-sidebar {
        display: flex !important; flex-direction: column; border: 1px solid var(--border); border-top: none;
        border-radius: 0 0 var(--radius) var(--radius); margin-top: 0; padding: 0.75rem;
      }
      .workflow-rec-list { max-height: 180px; }
      .node-editor-panel { margin-top: 0.5rem; }
      .form-section { padding: 0.75rem; }
      .form-row { flex-direction: column; align-items: stretch; gap: 0.25rem; }
      .form-row label { min-width: 0; }
      .form-row input[type="text"], .form-row input[type="number"], .form-row select { width: 100%; min-height: 44px; }
      .campaign-layout { grid-template-columns: 1fr; gap: 0.75rem; }
      .recordings-grid { grid-template-columns: 1fr; }
      .rec-card { padding: 0.6rem; }
      .rec-card .play { width: 44px; height: 44px; }
      .state-row { grid-template-columns: 1fr 1fr; gap: 0.4rem; font-size: 0.8rem; }
      .state-row.head { display: none; }
      .state-row > *:nth-child(1) { grid-column: 1 / -1; }
      .yaml-editor textarea, .form-generated textarea { min-height: 280px; }
      .yaml-preview { max-height: 50vh; font-size: 0.75rem; }
      .yaml-collapse-panel h3 { flex-wrap: wrap; gap: 0.5rem; }
      .monitor-toolbar { flex-direction: column; align-items: stretch; }
      .monitor-toolbar input[type="text"] { min-width: 0; width: 100%; }
      .monitor-log { min-height: 50vh; max-height: 60vh; }
      .stats-table { font-size: 0.8rem; }
      .stats-table th, .stats-table td { padding: 0.4rem 0.5rem; }
      .dryrun-bar { flex-direction: column; align-items: stretch; }
      .guide-content { font-size: 0.9rem; }
      .toolbar { gap: 0.5rem; }
    }
    @media (max-width: 480px) {
      .app { padding: 0.5rem; }
      .tabs button { padding: 0.45rem 0.6rem; font-size: 0.8rem; }
      .workflow-toolbar select { max-width: 140px; }
      .workflow-palette .node-type { min-width: 60px; padding: 0.45rem 0.5rem; font-size: 0.75rem; }
      .drawflow .drawflow-node { min-width: 120px !important; }
      .drawflow .drawflow-content { padding: 0.4rem 0.5rem; font-size: 0.75rem; }
    }
    /* Touch-friendly: larger tap targets, no double-tap zoom on canvas */
    .workflow-canvas-wrap { touch-action: pan-x pan-y; -webkit-tap-highlight-color: transparent; }
    .workflow-palette .node-type { -webkit-tap-highlight-color: transparent; }
    @media (hover: none) and (pointer: coarse) {
      .btn, .btn.secondary, .tabs button { min-height: 44px; }
      .rec-card .play, .workflow-rec-item .play-mini { min-width: 44px; min-height: 44px; }
    }
    /* Desktop: hide "More" button, always show secondary toolbar */
    @media (min-width: 769px) {
      .workflow-more-btn { display: none !important; }
      .workflow-toolbar-secondary { display: flex; }
    }

    /* ——— Collapsible sections (mobile only) ——— */
    @media (max-width: 768px) {
      .collapsible-mobile {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 0.5rem;
        overflow: hidden;
      }
      .collapsible-mobile summary {
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--text);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        min-height: 44px;
      }
      .collapsible-mobile summary::-webkit-details-marker { display: none; }
      .collapsible-mobile summary::after {
        content: '▼';
        font-size: 0.7rem;
        color: var(--text-muted);
        transition: transform 0.2s;
      }
      .collapsible-mobile[open] summary::after { transform: rotate(-180deg); }
      .collapsible-mobile summary:hover { color: var(--accent); }
      .collapsible-mobile .collapsible-mobile-content {
        padding: 0.75rem 1rem;
        border-top: 1px solid var(--border);
      }
      .collapsible-mobile .collapsible-mobile-content.pad-none { padding: 0; border-top: none; }
    }
    @media (min-width: 769px) {
      .collapsible-mobile summary { display: none; }
      .collapsible-mobile .collapsible-mobile-content { border: none !important; padding: 0 !important; }
      .collapsible-mobile { border: none !important; background: transparent !important; margin: 0 !important; }
    }