/* ============================================================================
   AUTOMATION ENGINE — Sales Hub HQ
   Styles for the Flow Builder and Automations rules table.
   Depends on: base/variables.css, components/buttons.css, components/forms.css
   ============================================================================ */

/* ── Root container ───────────────────────────────────────────────────────── */
/*  Parent (#salesHubPage) is display:block when .active-view, so fill via
    height:100% rather than flex:1.                                           */
#shhq-automation-root {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-bg-base);
}

/* ── Missing global variant: .btn.danger ─────────────────────────────────── */
/*  buttons.css defines .btn-icon.danger but not .btn.danger.
    The delete rows use class="btn danger small", so define it here.         */
.btn.danger {
    background-color: var(--color-danger);
    color: #fff;
}
.btn.danger:hover {
    background-color: #c0392b;
}

/* ── Header bar ────────────────────────────────────────────────────────────── */
.shhq-auto-header {
    flex-shrink: 0;
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 16px;
}

.shhq-auto-header-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 52px; /* matches --header-h */
    flex-wrap: wrap;
}

.shhq-auto-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-main);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: var(--font-brand, 'Chakra Petch', sans-serif);
    margin-right: 6px;
    white-space: nowrap;
}

.shhq-auto-title i {
    font-size: 1.05rem;
    color: var(--color-primary);
}

.shhq-auto-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-warning);
    border: 1px solid var(--color-warning);
    border-radius: 4px;
    padding: 2px 6px;
    margin-left: 2px;
    white-space: nowrap;
}

/* Sync status chip */
.shhq-sync-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    padding: 3px 8px;
    border-radius: 4px;
    margin-right: auto; /* push toolbar buttons to the right */
    transition: color 0.2s ease;
    white-space: nowrap;
}
.shhq-sync-status[data-state="pending"] { color: var(--color-warning); }
.shhq-sync-status[data-state="saved"]   { color: var(--color-success); }
.shhq-sync-status[data-state="offline"] { color: var(--color-danger); }
.shhq-sync-status[data-state="error"]   {
    color: var(--color-danger);
    background: var(--color-danger-dim);
}

@keyframes shhq-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}
.shhq-sync-status[data-state="pending"] i {
    animation: shhq-pulse 1.4s ease-in-out infinite;
}

/* ── Toolbar chips ────────────────────────────────────────────────────────── */
/*  Secondary action buttons in the header — sit alongside global .btn-icon   */
.shhq-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.shhq-chip:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-text-muted);
    color: var(--color-text-main);
}
.shhq-chip i { font-size: 0.875rem; }

.shhq-chip--clear {
    color: var(--color-danger);
    border-color: var(--color-danger-dim, rgba(240,107,107,0.2));
}
.shhq-chip--clear:hover {
    background: var(--color-danger-dim);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.shhq-chip--test {
    color: var(--color-warning);
    border-color: var(--color-warning-dim, rgba(232,168,74,0.18));
}
.shhq-chip--test:hover {
    background: var(--color-warning-dim);
    border-color: var(--color-warning);
    color: var(--color-warning);
}

/* Intelligence radar toggle */
.shhq-radar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-active);
    background: var(--color-active-dim);
    border: 1px solid rgba(77,148,235,0.25);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.shhq-radar-toggle:hover { background: rgba(77,148,235,0.2); }
.shhq-radar-toggle i     { font-size: 0.875rem; }

/* Deploy button — primary action, matches .btn.primary visual language */
.shhq-deploy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-bg-base); /* dark text on green — matches .btn.primary */
    background: var(--color-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
    white-space: nowrap;
}
.shhq-deploy-btn:hover {
    background: var(--color-primary-hover, #28b870);
    box-shadow: 0 0 12px var(--color-primary-glow, rgba(61,214,140,0.3));
}
.shhq-deploy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* New Automation / Add node buttons — ghost-green outline variant */
.shhq-btn-new {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-primary-dim);
    border: 1px solid rgba(61,214,140,0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}
.shhq-btn-new:hover {
    background: rgba(61,214,140,0.18);
    box-shadow: 0 0 8px var(--color-primary-glow, rgba(61,214,140,0.2));
}
.shhq-btn-new--lg {
    font-size: 0.9rem;
    padding: 10px 20px;
}

/* ── Sub-tab navigation ────────────────────────────────────────────────────── */
.shhq-sub-nav {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex-shrink: 0;
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 16px;
}
.shhq-sub-nav-spacer { flex: 1; }

.shhq-sub-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    margin-bottom: -1px; /* sit on top of the nav border */
    white-space: nowrap;
}
.shhq-sub-tab:hover { color: var(--color-text-main); }
.shhq-sub-tab--active {
    color: var(--color-active);
    border-bottom-color: var(--color-active);
}
.shhq-sub-tab i { font-size: 0.95rem; }

/* ── Flow panel — canvas + sidebars ─────────────────────────────────────── */
.shhq-flow-panel {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

/* Drawflow host */
.shhq-drawflow-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    overflow: hidden;
    background: var(--color-canvas-bg, #0b0d11);
    position: relative;
}

/* Subtle dot-grid canvas texture */
.shhq-drawflow-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(
        var(--color-canvas-dot, rgba(148,163,184,0.07)) 1px,
        transparent 0
    );
    background-size: 26px 26px;
    pointer-events: none;
    z-index: 0;
}

.shhq-drawflow-inner {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.shhq-drawflow-canvas {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ── Node library sidebar ─────────────────────────────────────────────────── */
.shhq-node-library {
    width: 210px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.shhq-lib-header {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    background: var(--color-bg-elevated);
    gap: 8px;
}

.shhq-lib-title {
    flex: 1;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* .shhq-lib-close uses global .btn-icon via JS: class="shhq-lib-close"
   but the JS doesn't add .btn-icon here, so add the bare minimum:         */
.shhq-lib-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 1rem;
    transition: color 0.15s, background 0.15s;
}
.shhq-lib-close:hover {
    color: var(--color-text-main);
    background: rgba(255,255,255,0.05);
}

.shhq-lib-content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}

.shhq-lib-section-title {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-faint, #4a5568);
    padding: 6px 4px 3px;
}

.shhq-lib-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    color: var(--color-text-main);
    font-size: 0.8rem;
    cursor: grab;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.shhq-lib-node:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-text-muted);
}
.shhq-lib-node:active { cursor: grabbing; }
.shhq-lib-node i { font-size: 1rem; flex-shrink: 0; }

/* Node kind colors — match the drawflow override injected by JS */
.shhq-lib-node--trigger  i { color: var(--color-warning); }
.shhq-lib-node--action   i { color: var(--color-active); }
.shhq-lib-node--filter   i { color: var(--color-primary); }
.shhq-lib-node--route    i { color: var(--color-success); }
.shhq-lib-node--dispatch i { color: var(--color-warning); }

/* ── Radar / Intelligence drawer ──────────────────────────────────────────── */
.shhq-radar-drawer {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-surface);
    border-left: 1px solid var(--color-border);
    overflow: hidden;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.shhq-radar-header {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    background: var(--color-bg-elevated);
    gap: 8px;
}

.shhq-radar-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-active);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.shhq-radar-subtitle {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-faint, #4a5568);
    padding: 5px 14px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-surface);
    flex-shrink: 0;
}

.shhq-radar-log {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.shhq-radar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 16px;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    text-align: center;
    font-family: var(--font-base, 'Inter', sans-serif);
}
.shhq-radar-empty i { font-size: 2rem; opacity: 0.3; }

.shhq-radar-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 0.68rem;
    background: var(--color-bg-elevated);
    border-left: 2px solid var(--color-border);
    word-break: break-word;
    line-height: 1.5;
}
.shhq-radar-row--success { border-left-color: var(--color-success); }
.shhq-radar-row--error   { border-left-color: var(--color-danger); }
.shhq-radar-row--pending { border-left-color: var(--color-warning); }

/* ── Rules panel (Automations table) ─────────────────────────────────────── */
.shhq-rules-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-bg-base);
}

.shhq-rules-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.shhq-rules-table-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
}

/* Empty state */
.shhq-rules-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 64px 20px;
    color: var(--color-text-muted);
    text-align: center;
}
.shhq-rules-empty i    { font-size: 3rem; opacity: 0.25; }
.shhq-rules-empty span { font-size: 1rem; font-weight: 600; color: var(--color-text-main); }
.shhq-rules-empty p    {
    font-size: 0.825rem;
    max-width: 340px;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
}

/* Table */
.shhq-rules-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.shhq-rules-table thead tr {
    background: var(--color-bg-surface);
    border-bottom: 2px solid var(--color-border);
}

.shhq-rules-table th {
    padding: 9px 12px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.shhq-rules-table td {
    padding: 11px 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border-subtle, rgba(180,190,210,0.07));
    color: var(--color-text-main);
}

.shhq-rules-row { transition: background 0.12s ease; }
.shhq-rules-row:hover td { background: var(--color-bg-hover); }

/* Name cell */
.shhq-rules-name { display: flex; flex-direction: column; gap: 2px; }
.shhq-rules-name-text { font-weight: 600; }
.shhq-rules-desc  { font-size: 0.73rem; color: var(--color-text-muted); }

/* Other cells */
.shhq-rules-event  { font-size: 0.78rem; color: var(--color-text-muted); }
.shhq-rules-module { font-size: 0.78rem; color: var(--color-text-muted); }
.shhq-rules-lastrun { font-size: 0.78rem; }
.shhq-rules-count   { font-size: 0.78rem; color: var(--color-text-muted); }

.shhq-rules-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Utility text colours */
.shhq-run-ok  { color: var(--color-success); }
.shhq-run-err { color: var(--color-danger); }
.shhq-muted   { color: var(--color-text-muted); }

/* Status pills */
.shhq-status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}
.shhq-status--active   { background: var(--color-success-dim); color: var(--color-success); }
.shhq-status--draft    { background: var(--color-neutral-dim, rgba(136,146,164,0.13)); color: var(--color-neutral, #8892a4); }
.shhq-status--paused   { background: var(--color-warning-dim); color: var(--color-warning); }
.shhq-status--archived { background: var(--color-danger-dim); color: var(--color-danger); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.shhq-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-index-modal, 10000);
    display: flex;
    align-items: center;
    justify-content: center;
}

.shhq-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.shhq-modal-card {
    position: relative;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow-xl);
    width: 520px;
    max-width: calc(100vw - 32px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: shhq-modal-in 0.18s ease-out;
}

@keyframes shhq-modal-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.shhq-form-card { width: 600px; }

.shhq-modal-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    background: var(--color-bg-elevated);
    gap: 10px;
}
.shhq-modal-header h3 {
    flex: 1;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.shhq-modal-header h3 i { color: var(--color-primary); }

/*  Node config modal body (flat label + input siblings — no section wrappers)
    Flex column keeps items stacked; gap: 6px keeps label close to its input. */
.shhq-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/*  New Automation form body — contains stacked .shhq-form-section cards.
    No gap here; cards use margin-bottom for the connector-line spacing.    */
.shhq-form-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.shhq-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 13px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    flex-shrink: 0;
}

/* ── Form layout ──────────────────────────────────────────────────────────── */
.shhq-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.shhq-form-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.shhq-form-col--grow { flex: 1; }

/*  ── Workflow section cards (Trigger / Conditions / Actions) ──────────────
    These are the "node cards" stacked vertically in the New Automation form.
    margin-bottom instead of margin-top so the ::before connector can bridge
    upward into the gap between consecutive sections.                        */
.shhq-form-section {
    position: relative;     /* anchor for the ::before connector line */
    padding: 14px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;              /* space-md: breathing room between internal fields */
    margin-bottom: 28px;    /* space-xl: gap the connector line will span */
}

/*  Vertical connector line — drawn on sections that directly follow
    another section (second and third cards only, never the last one).      */
.shhq-form-section + .shhq-form-section::before {
    content: '';
    position: absolute;
    top: -28px;             /* reach UP into the margin-bottom of the card above */
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 28px;
    background: var(--color-border);
    pointer-events: none;
    z-index: 0;
}

/*  Node card header — flex row with title on left, sub-label on right,
    separated from the body by a border.                                     */
.shhq-form-section-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-main);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 10px;
    /* gap between this header row and the first form field below it */
    margin-bottom: 2px;
}
.shhq-form-section-hd i { color: var(--color-active); font-size: 0.95rem; }

.shhq-form-section-sub {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    /* sits on the right via justify-content: space-between on the header */
}

/* Labels */
.shhq-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
    margin-bottom: 4px;     /* space-xs: tight coupling to the field below */
}
.shhq-required   { color: var(--color-danger); margin-left: 2px; }
.shhq-label-hint { color: var(--color-text-muted); font-weight: 400; }

/*  Scoped input/select widths inside automation modals.
    modern-input already has width:100% globally; alzar-select does not.   */
.shhq-modal-body .alzar-select,
.shhq-form-body  .alzar-select {
    width: 100%;
    box-sizing: border-box;
}

.shhq-modal-body .modern-input,
.shhq-form-body  .modern-input {
    width: 100%;
    box-sizing: border-box;
}

/* Status radio row */
.shhq-form-status-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.shhq-radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: var(--color-text-main);
    cursor: pointer;
}

/* ── Conditions / Actions list ───────────────────────────────────────────── */
.shhq-cond-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shhq-cond-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    flex-wrap: wrap;
}

.shhq-action-row-inner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.shhq-act-fields {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Add / Remove row buttons */
.shhq-add-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-active);
    background: var(--color-active-dim);
    border: 1px solid rgba(77,148,235,0.25);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s;
    width: fit-content;
}
.shhq-add-row-btn:hover { background: rgba(77,148,235,0.2); }

.shhq-remove-row-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
    transition: color 0.15s, background 0.15s;
}
.shhq-remove-row-btn:hover {
    color: var(--color-danger);
    background: var(--color-danger-dim);
}

/* ── Automation tab pill (injected alongside .sales-hub-pill in nav) ─────── */
.shhq-automation-pill {
    border-left: 1px solid var(--color-border);
    margin-left: 4px;
    padding-left: 12px;
}

/* ── Drawflow canvas node overrides ──────────────────────────────────────── */
/*  The JS injects a <style id="shhq-drawflow-overrides"> at boot time for
    node background/border/shadow. The rules below handle the node HEADER
    layout and the delete button which the JS tag does not cover.           */

/*  Node header row: kind badge on left, delete icon on right.
    Uses !important to win over the JS-injected style tag.                  */
.drawflow-node .shhq-node-kind {
    justify-content: space-between !important;
    border-bottom: 1px solid var(--color-border) !important;
    padding-bottom: 6px !important;
    margin-bottom: 6px !important;
}

/*  Drawflow delete (×) button — shown only when the node is selected.     */
.drawflow-node .drawflow_delete {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--color-bg-overlay);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.drawflow-node .drawflow_delete:hover {
    background: var(--color-danger-dim);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/*  If node cards ever receive embedded form fields (via _addNode html),
    these rules handle spacing so nothing bleeds into the connector ports.  */
.shhq-node-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.shhq-node-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.shhq-node-field label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

.shhq-node-field .modern-input,
.shhq-node-field .alzar-select {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.78rem;
    padding: 5px 8px;
    min-height: unset;
}

/* ── Token hint (available template variables) ───────────────────────────── */
.shhq-token-hint {
    font-size: 0.68rem;
    color: var(--color-text-faint, #4a5568);
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 5px 10px;
    line-height: 1.5;
    margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — The flow canvas requires desktop; show message on mobile
   ════════════════════════════════════════════════════════════════ */
.shhq-mobile-notice { display: none; }

@media (max-width: 768px) {
    #shhq-automation-root {
        position: relative;
    }
    .shhq-mobile-notice {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 40px 24px;
        text-align: center;
        background: var(--color-bg-surface);
        border: 1px solid var(--color-border);
        border-radius: 12px;
        margin: 24px 16px;
        color: var(--color-text-muted);
        font-size: 0.9rem;
        line-height: 1.5;
    }
    .shhq-mobile-notice i {
        font-size: 2rem;
        color: var(--color-warning);
    }
    .shhq-canvas-area {
        display: none;
    }
}
