/* The automation editor shares the inbox palette without changing other settings pages. */
#automations-view {
  --automation-ink:#e4f0f3;
  --automation-muted:#9bb6c0;
  --automation-line:#254a57;
  --automation-accent:#29e0b4;
  --automation-bg:#061c22; --automation-surface:#082831; --automation-input:#071f27;
  --automation-selected:#073d37; --automation-selected-line:#10b78f;
  --automation-bubble:#064a3c; --automation-bubble-line:#11705c; --automation-wallpaper:#041820c2;
  --automation-shadow:0 2px 6px #0000000b; --automation-soft:#0d3039;
  --ink:var(--automation-ink); --muted:var(--automation-muted); --line:var(--automation-line);
  --accent:var(--automation-accent); --theme-input:var(--automation-input);
  color:var(--automation-ink);
  background:var(--automation-bg);
  padding:17px clamp(18px,2.25vw,30px) 22px;
  scrollbar-color:var(--chat-ui-scroll,#456268) transparent;
}
html[data-theme="light"] #automations-view {
  --automation-ink:#173b40; --automation-muted:#5c7980; --automation-line:#cbdfdf; --automation-accent:#078668;
  --automation-bg:#f2f8f7; --automation-surface:#fcfefe; --automation-input:#f7fbfa;
  --automation-selected:#e2f5ee; --automation-selected-line:#38a78d;
  --automation-bubble:#ddf6eb; --automation-bubble-line:#add9ca; --automation-wallpaper:#f4faf8d9;
  --automation-shadow:0 2px 8px #123a3310; --automation-soft:#edf7f4;
}
#automations-view [hidden] { display:none!important; }
#automations-view .automation-heading { align-items:center; gap:20px; margin-bottom:14px; min-height:68px; }
#automations-view .automation-heading h1 { margin:2px 0 0; color:var(--automation-ink); font-size:26px; line-height:1.4; font-weight:700; }
#automations-view .automation-heading p { margin:3px 0 0; color:var(--automation-muted); font-size:12px; line-height:1.6; }
#automations-view .automation-heading .eyebrow { color:var(--automation-muted); font-size:11px; letter-spacing:0; }
#automations-view .automation-save-tools { display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center; gap:4px 10px; max-width:280px; }
#automations-view #save-automations { display:inline-flex; gap:10px; align-items:center; justify-content:center; min-height:43px; padding:10px 22px; border:1px solid var(--automation-selected-line); border-radius:11px; color:var(--chat-ui-primary-text,#f5fffb); background:var(--chat-ui-primary-fill,linear-gradient(145deg,#168a70,#08614f)); box-shadow:var(--automation-shadow); font-size:13px; font-weight:600; white-space:nowrap; }
#automations-view #save-automations:disabled { opacity:.65; cursor:wait; }
#automations-view :is(#automation-save-status,.automation-dirty-status) { color:var(--automation-muted); font-size:11px; line-height:1.6; }
#automations-view #automation-save-status:not(:empty) { flex-basis:100%; text-align:end; }
#automations-view .automation-dirty-status:not(:empty) { color:var(--automation-accent); }
#automations-view .automation-save-feedback { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
#automations-view #automation-save-error { flex:1; color:var(--chat-ui-error,#ff95a1); background:var(--chat-ui-error-bg,#39262e); border:1px solid var(--chat-ui-error-line,#73414b); border-radius:10px; padding:10px 14px; margin:0 0 16px; font-size:12px; line-height:1.8; }
#automations-view #automation-reload-settings { margin-bottom:16px; }
#automations-view .automation-tabs { display:grid; grid-template-columns:1fr 1fr; gap:0; padding:0; margin-bottom:12px; background:var(--automation-input); border:1px solid var(--automation-line); border-radius:12px; box-shadow:none; }
#automations-view .automation-tabs button { display:flex; align-items:center; justify-content:center; gap:12px; min-height:47px; padding:10px 12px; border:1px solid transparent; border-radius:9px; background:transparent; color:var(--automation-muted); font:inherit; font-size:14px; font-weight:600; }
#automations-view .automation-tabs button[aria-selected="true"] { color:var(--automation-ink); border-color:var(--automation-selected-line); background:var(--automation-selected); box-shadow:none; }
#automations-view .automation-tabs button[aria-selected="true"] svg { color:var(--automation-accent); }
#automations-view .automation-tabs button:hover { color:var(--automation-ink); }
#automations-view .automation-layout { display:grid; grid-template-columns:minmax(0,1.14fr) minmax(0,.98fr); align-items:stretch; gap:12px; direction:rtl; }
#automations-view .automation-card { min-width:0; padding:14px 20px; background:var(--automation-surface); border:1px solid var(--automation-line); border-radius:14px; box-shadow:var(--automation-shadow); }
#automations-view .automation-fields { min-width:0; padding:0; margin:0; border:0; }
#automations-view .automation-editor-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; }
#automations-view .automation-editor-heading h2 { margin:0; font-size:18px; font-weight:650; color:var(--automation-ink); }
#automations-view .automation-enabled { display:flex; align-items:center; gap:10px; color:var(--automation-muted); font-size:11px; white-space:nowrap; }
#automations-view .switch { width:46px; height:26px; }
#automations-view .switch>span { border:1px solid var(--automation-line); background:var(--automation-input); }
#automations-view .switch>span:after { width:19px; height:19px; left:3px; top:2px; box-shadow:0 1px 3px #0003; }
#automations-view .switch input:checked+span { background:var(--chat-ui-primary-fill); border-color:var(--automation-selected-line); }
#automations-view .switch input:checked+span:after { transform:translateX(19px); }
#automations-view .switch input:disabled+span { cursor:wait; opacity:.65; }
#automations-view .automation-timing { font-size:10px; line-height:1.65; color:var(--automation-muted); margin:3px 0 8px; }
#automations-view .automation-editor-section { padding:4px 0; border-top:1px solid var(--automation-line); }
#automations-view .automation-editor-section:last-child { padding-bottom:0; }
#automations-view .automation-step { display:flex; align-items:flex-start; gap:9px; margin-bottom:4px; }
#automations-view .automation-step-number { display:grid; place-items:center; width:24px; height:24px; flex:none; margin-top:1px; color:var(--automation-muted); border:1px solid var(--automation-line); border-radius:50%; background:var(--automation-input); box-shadow:none; font-size:12px; font-variant-numeric:tabular-nums; }
#automations-view .automation-step h3 { margin:0; font-size:13px; line-height:1.5; font-weight:650; color:var(--automation-ink); }
#automations-view .automation-step p { font-size:11px; color:var(--automation-muted); line-height:1.5; margin:1px 0 0; }
#automations-view .automation-type-choices { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
#automations-view .automation-type-choice { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; padding:10px 8px; min-height:76px; min-width:0; color:var(--automation-muted); background:var(--automation-input); border:1px solid var(--automation-line); border-radius:11px; box-shadow:none; font:inherit; font-size:12px; line-height:1.5; }
#automations-view .automation-type-choice>svg { width:25px; height:25px; }
#automations-view .automation-type-choice[aria-pressed="true"] { color:var(--automation-accent); background:var(--automation-selected); border-color:var(--automation-selected-line); box-shadow:inset 0 0 10px #0dd6a40b; }
#automations-view .automation-type-choice:not(:disabled):hover { border-color:var(--automation-accent); }
#automations-view .automation-type-check { position:absolute; inset-inline-end:9px; top:9px; display:grid; place-items:center; width:17px; height:17px; border-radius:50%; background:var(--automation-accent); color:var(--chat-ui-primary-ink,#082c23); }
#automations-view .automation-type-check svg { width:12px; height:12px; }
#automations-view .automation-type-choice[aria-pressed="false"] .automation-type-check { visibility:hidden; }
#automations-view .automation-message-field { display:block; margin:0; }
#automations-view :is(textarea,input:not([type="checkbox"]),select) { width:100%; min-width:0; padding:7px 10px; border:1px solid var(--automation-line); border-radius:10px; background:var(--automation-input); color:var(--automation-ink); box-shadow:inset 0 1px 3px #00000009; font:inherit; font-size:12px; line-height:1.7; }
#automations-view textarea { display:block; resize:vertical; min-height:100px; }
#automations-view :is(textarea,input)::placeholder { color:var(--automation-muted); opacity:.65; }
#automations-view :is(textarea,input:not([type="checkbox"]),select):focus { border-color:var(--automation-accent); outline:none; box-shadow:var(--chat-ui-focus); }
#automations-view .automation-message-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:7px; margin-top:6px; }
#automations-view .outline-button { display:inline-flex; gap:7px; align-items:center; justify-content:center; min-height:28px; padding:4px 9px; font-size:11px; color:var(--automation-muted); border:1px solid var(--automation-line); border-radius:8px; background:var(--automation-input); }
#automations-view .outline-button:not(:disabled):hover { color:var(--automation-accent); border-color:var(--automation-accent); }
#automations-view .automation-message-toolbar code { padding:4px 7px; border:1px solid var(--automation-line); border-radius:7px; font-size:10px; color:var(--automation-muted); background:var(--automation-input); }
#automations-view .automation-interactive-slot:empty { display:none; }
#automations-view .automation-interactive-slot { border-top:1px solid var(--automation-line); padding-top:8px; }
#automations-view #welcome-interactive-editor { margin:0; }
#automations-view .interactive-editor { gap:7px; }
#automations-view .interactive-editor label { font-size:12px; line-height:1.7; color:var(--automation-muted); }
#automations-view .interactive-editor small { color:var(--automation-muted); font-size:11px; }
#automations-view .interactive-button-row { padding:14px; gap:10px; background:var(--automation-bg); border-color:var(--automation-line); }
#automations-view .interactive-button-row textarea { min-height:70px; }
#automations-view .interactive-button-row legend { color:var(--automation-accent); }
#automations-view .interactive-button-row .text-button { justify-self:start; font-size:11px; color:var(--chat-ui-error,#ff95a1); }
#automations-view .automation-preview-card { display:flex; flex-direction:column; gap:12px; }
#automations-view .automation-preview-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
#automations-view .automation-preview-heading h2 { display:flex; align-items:center; gap:9px; margin:0; color:var(--automation-ink); font-size:16px; font-weight:650; }
#automations-view .automation-preview-heading p { margin:1px 0 0; font-size:10px; line-height:1.7; color:var(--automation-muted); }
#automations-view .automation-preview-type { flex:none; max-width:42%; padding:5px 12px; border:1px solid var(--automation-bubble-line); border-radius:20px; background:var(--automation-selected); color:var(--automation-accent); font-size:11px; line-height:1.8; text-align:center; }
#automations-view .automation-preview-conversation { display:flex; flex-direction:column; flex:1; min-height:390px; padding:20px; border:1px solid var(--automation-line); border-radius:13px; overflow:hidden; background-color:var(--automation-bg); background-image:linear-gradient(var(--automation-wallpaper),var(--automation-wallpaper)),url('/chat-wallpaper.svg'); background-size:auto,350px 247px; }
#automations-view .automation-preview-business { display:flex; direction:ltr; gap:9px; align-items:center; min-height:56px; padding:9px 14px; border-bottom:1px solid var(--automation-line); background:var(--automation-surface); color:var(--automation-ink); }
#automations-view .automation-preview-business img { width:34px; height:34px; flex:none; object-fit:contain; }
#automations-view .automation-preview-business strong { font-size:13px; font-weight:650; overflow-wrap:anywhere; }
#automations-view .automation-preview-canvas { display:flex; align-items:flex-start; justify-content:flex-start; padding:14px 10px 20px; flex:1; }
#automations-view .automation-preview-bubble { width:fit-content; max-width:94%; min-width:min(160px,100%); padding:10px 11px 6px; border:1px solid var(--automation-bubble-line); border-radius:14px 4px 14px 14px; background:var(--automation-bubble); box-shadow:0 2px 4px #00000010; color:var(--automation-ink); }
#automations-view .automation-preview-body { font-size:12px; line-height:1.9; white-space:pre-wrap; overflow-wrap:anywhere; }
#automations-view .automation-preview-body:empty:before { content:'ستظهر معاينة رسالتك هنا…'; color:var(--automation-muted); }
#automations-view .automation-preview-meta { display:flex; gap:5px; justify-content:flex-end; align-items:center; margin-top:6px; color:var(--automation-muted); font-size:9px; }
#automations-view .automation-preview-meta svg { width:15px; height:15px; color:var(--automation-accent); }
#automations-view .interactive-message-actions { margin-top:8px; }
#automations-view .interactive-message-button { color:var(--automation-accent); border-color:var(--automation-bubble-line); background:color-mix(in srgb,var(--chat-ui-outgoing,#0e493f) 40%,transparent); font-size:12px; padding:9px 10px; }
#automations-view .automation-preview-note { display:flex; align-items:flex-start; gap:8px; margin:0; color:var(--automation-muted); font-size:11px; line-height:1.8; }
#automations-view .automation-info-note { display:flex; gap:9px; align-items:flex-start; padding:8px 12px; margin-top:11px; border:1px solid var(--automation-line); border-radius:10px; background:var(--automation-input); color:var(--automation-muted); font-size:11px; line-height:1.9; }
#automations-view svg { display:block; width:19px; height:19px; flex:none; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
#automations-view :is(.automation-info-note,.automation-preview-note) svg { width:16px; height:16px; margin-top:2px; }
#automations-view button:focus-visible { outline:2px solid var(--automation-accent); outline-offset:3px; }
#automations-view button:not(:disabled) { cursor:pointer; }
#automations-view .automation-fields:disabled :is(button,input,textarea,select) { opacity:.65; cursor:wait; }
#automations-view .automation-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
#automations-view .automation-breadcrumb { display:flex; align-items:center; gap:5px; }
#automations-view .automation-breadcrumb svg { width:12px; height:12px; stroke-width:2; }
#automations-view #save-automations { flex-direction:row-reverse; min-height:42px; padding:9px 21px; border-radius:8px; color:#effffc; background:linear-gradient(115deg,#077b63,#12aa86); border-color:#26d9b0; box-shadow:inset 0 1px 4px #8bffe729,0 3px 8px #031f1a33; }
#automations-view .automation-tabs { border-radius:8px; background:var(--automation-surface); }
#automations-view .automation-tabs button { flex-direction:row-reverse; margin:-1px; min-height:46px; padding:8px 12px; border-radius:8px; }
#automations-view .automation-tabs svg { width:24px; height:24px; }
#automations-view .automation-card { border-radius:10px; }
#automations-view .automation-enabled { color:var(--automation-ink); font-size:12px; font-weight:600; gap:12px; }
#automations-view .switch input:checked+span { background:linear-gradient(90deg,#079774,#27d6a6); border-color:#15bb92; }
#automations-view .automation-step-number { color:var(--automation-ink); border-color:color-mix(in srgb,var(--automation-line) 55%,var(--automation-muted)); background:var(--automation-soft); box-shadow:inset 0 1px 4px #90c7d224; font-size:11px; }
#automations-view .automation-step p { font-size:10px; }
#automations-view .automation-type-choice { border-radius:8px; font-size:11px; }
#automations-view :is(#welcome-text,#closing-text) { height:88px; min-height:88px; }
#automations-view :is(textarea,input:not([type="checkbox"]),select) { border-radius:7px; }
#automations-view .automation-message-toolbar .outline-button { font-size:10px; border-radius:6px; }
#automations-view .automation-message-toolbar svg { width:15px; height:15px; }
#automations-view .interactive-editor label { margin:0; font-size:11px; line-height:1.5; }
#automations-view .automation-cta-settings .interactive-editor>label,
#automations-view .automation-link-fields>label { display:grid; grid-template-columns:105px minmax(0,1fr); align-items:center; gap:10px; }
#automations-view .automation-cta-settings .interactive-editor>label input { min-height:32px; padding:5px 10px; margin:0; }
#automations-view .automation-editor-hint,
#automations-view .field-hint,
#automations-view #welcome-interactive-slot+.field-hint,
#automations-view .automation-fields>.field-hint,
#automations-view .automation-interactive-slot .field-hint { display:flex; align-items:center; justify-content:center; gap:6px; margin:7px 0 0; padding:5px 9px; border:1px solid var(--automation-line); border-radius:6px; background:var(--automation-soft); color:var(--automation-muted); font-size:10px; line-height:1.7; }
#automations-view .automation-preview-type { display:inline-flex; align-items:center; justify-content:center; gap:9px; margin-top:1px; padding:4px 13px; font-size:10px; }
#automations-view .automation-preview-type svg { width:16px; height:16px; }
#automations-view .automation-preview-window { display:flex; flex-direction:column; flex:1; min-width:0; overflow:hidden; border:1px solid var(--automation-line); border-radius:9px; background:color-mix(in srgb,var(--automation-bg) 45%,transparent); }
#automations-view .automation-preview-canvas { direction:rtl; min-width:0; }
#automations-view .automation-preview-meta { flex-direction:row-reverse; justify-content:flex-start; }
#automations-view .interactive-message-button { display:flex; flex-direction:row-reverse; align-items:center; justify-content:center; gap:9px; background:color-mix(in srgb,var(--automation-bubble) 80%,var(--automation-input)); }
#automations-view .interactive-message-button svg { width:16px; height:16px; }
@media (min-width:1001px) {
  #automations-view .automation-preview-card { min-height:494px; }
}
@media (max-width:1100px) {
  #automations-view .automation-card { padding:15px; }
  #automations-view .automation-layout { gap:12px; }
  #automations-view .automation-preview-conversation { padding:14px; }
  #automations-view .automation-cta-settings .interactive-editor>label { grid-template-columns:80px minmax(0,1fr); }
  #automations-view .automation-editor-heading h2 { font-size:17px; }
  #automations-view .automation-enabled { gap:7px; }
}
@media (max-width:1000px) {
  #automations-view .automation-layout { grid-template-columns:minmax(0,1fr); }
  #automations-view .automation-preview-conversation { min-height:290px; }
}
@media (max-width:600px) {
  #automations-view { padding:16px 12px 22px; }
  #automations-view .automation-heading { align-items:flex-start; flex-direction:column; gap:15px; margin-bottom:18px; }
  #automations-view .automation-heading h1 { font-size:24px; }
  #automations-view .automation-save-tools { max-width:none; width:100%; justify-content:flex-start; }
  #automations-view #automation-save-status:not(:empty) { text-align:start; }
  #automations-view #save-automations { padding:9px 17px; min-height:40px; font-size:12px; }
  #automations-view .automation-tabs { gap:2px; margin-bottom:13px; }
  #automations-view .automation-tabs button { font-size:11px; padding:9px 5px; gap:7px; min-height:43px; }
  #automations-view .automation-tabs svg { width:17px; height:17px; }
  #automations-view .automation-card { padding:16px 13px; border-radius:12px; }
  #automations-view .automation-editor-heading { gap:10px; flex-wrap:wrap; }
  #automations-view .automation-editor-heading h2 { font-size:16px; }
  #automations-view .automation-enabled { font-size:10px; }
  #automations-view .automation-type-choices { gap:7px; }
  #automations-view .automation-type-choice { min-height:78px; padding:12px 5px; font-size:11px; gap:8px; }
  #automations-view .automation-type-choice>svg { width:22px; height:22px; }
  #automations-view .automation-type-check { width:14px; height:14px; top:6px; inset-inline-end:6px; }
  #automations-view :is(textarea,input:not([type="checkbox"]),select) { font-size:16px; }
  #automations-view :is(#welcome-text,#closing-text) { height:112px; }
  #automations-view .automation-cta-settings .interactive-editor>label { display:flex; flex-direction:column; align-items:stretch; gap:4px; }
  #automations-view .automation-preview-conversation { padding:12px; min-height:330px; }
  #automations-view .automation-preview-heading h2 { font-size:15px; }
  #automations-view .automation-preview-type { padding:4px 9px; font-size:10px; }
  #automations-view .automation-preview-canvas { padding:20px 12px 26px; }
}
@media (prefers-reduced-motion:reduce) {
  #automations-view *,#automations-view *:after { scroll-behavior:auto!important; animation:none!important; transition:none!important; }
}
