/* Automations: tenant switch, two tabs, rule list + three-part rule editor (Kiedy / Jeśli / Wtedy), test box, run history, review queue. */
.automations-workspace { --au-ink-2: #5d6b64; --au-line: #e3e9e4; --au-soft: #f5f8f6; --au-accent: #167a55; }
.automations-workspace label { margin: 0; }
.automations-workspace input[type="radio"], .automations-workspace input[type="checkbox"] { width: 16px; height: 16px; padding: 0; margin: 0; flex: none; accent-color: var(--au-accent); }
.automations-workspace .au-switch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; padding: 12px 14px; border: 1px solid #cfe5d8; background: #f1f8f4; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.automations-workspace .au-switch:empty { display: none; }
.automations-workspace .au-switch > span:nth-child(2) { flex: 1 1 260px; }
.automations-workspace .au-switch.paused { border-color: #f0d9a8; background: #fdf7ea; }
.automations-workspace .au-dot { width: 9px; height: 9px; border-radius: 50%; background: #b0892d; flex: none; }
.automations-workspace .au-dot.on { background: #1f9d63; box-shadow: 0 0 0 4px #1f9d6324; }
.automations-workspace .au-switch .btn { padding: 7px 12px; font-size: 13px; }
.automations-workspace .au-tabs { display: flex; gap: 2px; border-bottom: 1px solid #e1e8e2; margin: 0 0 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.automations-workspace .au-tabs button { border: 0; background: transparent; padding: 10px 14px; font-size: 13px; font-weight: 650; color: #5d6b64; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.automations-workspace .au-tabs button[aria-selected="true"] { color: #17372b; border-bottom-color: var(--au-accent); }
.automations-workspace .au-count:not(:empty) { display: inline-block; margin-left: 6px; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: #e7f1eb; color: #17372b; font-size: 11px; text-align: center; }
.automations-workspace .au-layout { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.automations-workspace .au-single { max-width: 860px; }
.automations-workspace .au-main { display: grid; gap: 14px; min-width: 0; }
.automations-workspace .au-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; position: sticky; top: 12px; }
.automations-workspace .au-item { position: relative; }
.automations-workspace .au-open { display: grid; gap: 4px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--au-line); border-radius: 12px; padding: 12px 56px 12px 14px; color: inherit; }
.automations-workspace .au-open:hover { border-color: #b9d3c3; }
.automations-workspace .au-item.current .au-open { border-color: var(--au-accent); box-shadow: 0 0 0 3px #167a5514; }
.automations-workspace .au-open strong { font-size: 14px; overflow-wrap: anywhere; }
.automations-workspace .au-open small { color: var(--au-ink-2); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.automations-workspace .au-open .au-pill { justify-self: start; }
.automations-workspace .au-toggle { position: absolute; top: 12px; right: 12px; display: inline-flex; }
.automations-workspace .au-toggle input { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 999px; background: #c9d3cd; position: relative; cursor: pointer; transition: background .15s; border: 0; }
.automations-workspace .au-toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px #0003; }
.automations-workspace .au-toggle input:checked { background: var(--au-accent); }
.automations-workspace .au-toggle input:checked::after { transform: translateX(14px); }
.automations-workspace .au-toggle input:focus-visible { outline: 3px solid #629f88; outline-offset: 2px; }
.automations-workspace .au-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; background: #eef2ef; color: #4b5a52; white-space: nowrap; }
.automations-workspace .au-pill.on, .automations-workspace .au-pill.ok { background: #e3f4ea; color: #12603f; }
.automations-workspace .au-pill.changed, .automations-workspace .au-pill.wait { background: #fdf2dc; color: #7a5612; }
.automations-workspace .au-pill.off { background: #eceef0; color: #5b636b; }
.automations-workspace .au-pill.bad { background: #fbe6e3; color: #9b2c22; }
.automations-workspace .au-editor, .automations-workspace .au-card { background: #fff; border: 1px solid var(--au-line); border-radius: 14px; padding: 18px; min-width: 0; }
.automations-workspace .au-card h3 { font-size: 15px; margin: 0 0 8px; }
.automations-workspace .au-editor-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 0 0 6px; }
.automations-workspace .au-name { flex: 1 1 280px; }
.automations-workspace .au-field { display: grid; gap: 6px; font-size: 12px; font-weight: 650; }
.automations-workspace .au-field input, .automations-workspace .au-field select, .automations-workspace .au-field textarea { padding: 10px 12px; }
.automations-workspace .au-section { border: 0; border-top: 1px solid var(--au-line); margin: 16px 0 0; padding: 14px 0 0; min-width: 0; }
.automations-workspace .au-section legend { display: flex; align-items: center; gap: 8px; padding: 0; font-weight: 700; font-size: 14px; float: left; width: 100%; margin: 0 0 10px; }
.automations-workspace .au-section legend + * { clear: both; }
.automations-workspace .au-section legend small { font-weight: 500; color: var(--au-ink-2); font-size: 12px; }
.automations-workspace .au-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #e7f1eb; color: #17372b; font-size: 12px; }
.automations-workspace .au-triggers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.automations-workspace .au-trigger { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--au-line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.automations-workspace .au-trigger:has(input:checked) { border-color: var(--au-accent); background: #f1f8f4; }
.automations-workspace .au-trigger input { margin-top: 2px; }
.automations-workspace .au-trigger span { display: grid; gap: 3px; }
.automations-workspace .au-trigger strong { font-size: 13px; }
.automations-workspace .au-trigger small { color: var(--au-ink-2); font-size: 12px; line-height: 1.4; }
.automations-workspace .au-channels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 0; }
.automations-workspace .au-label { font-size: 12px; font-weight: 650; margin-right: 4px; }
.automations-workspace .au-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--au-line); border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; }
.automations-workspace .au-chip:has(input:checked) { border-color: var(--au-accent); background: #f1f8f4; }
.automations-workspace .au-chip:has(input:disabled) { opacity: .55; cursor: default; }
.automations-workspace .au-steps { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.automations-workspace .au-step { display: grid; grid-template-columns: 24px minmax(170px, 230px) minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px; background: var(--au-soft); border-radius: 10px; }
.automations-workspace .au-step select, .automations-workspace .au-step input, .automations-workspace .au-step textarea { padding: 8px 10px; font-size: 13px; background: #fff; }
.automations-workspace .au-step > select:nth-child(2):nth-last-child(2) { grid-column: 2 / 4; }
.automations-workspace .au-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 1px solid var(--au-line); font-size: 11px; font-weight: 700; color: var(--au-ink-2); }
.automations-workspace .au-move { display: inline-flex; gap: 2px; }
.automations-workspace .au-icon { width: 30px; height: 30px; border-radius: 8px; background: transparent; color: #4b5a52; font-size: 16px; line-height: 1; }
.automations-workspace .au-icon:hover:not(:disabled) { background: #e3ebe6; }
.automations-workspace .au-add { padding: 7px 12px; font-size: 13px; }
.automations-workspace .au-hint { margin: 0 0 10px; color: var(--au-ink-2); font-size: 12px; line-height: 1.5; }
.automations-workspace .au-hint a { color: var(--au-accent); text-decoration: underline; }
.automations-workspace .au-hint:last-child { margin: 10px 0 0; }
.automations-workspace .au-problems { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: #fbe9e6; color: #7d2219; font-size: 13px; }
.automations-workspace .au-problems ul { margin: 6px 0 0; padding-left: 18px; }
.automations-workspace .au-buttons { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--au-line); }
.automations-workspace .au-buttons .au-delete { margin-right: auto; }
.automations-workspace .au-test-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 10px; }
.automations-workspace .au-test-row .au-field { min-width: 170px; }
.automations-workspace .au-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; padding-bottom: 10px; }
.automations-workspace .au-test-result:not(:empty) { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--au-soft); font-size: 13px; }
.automations-workspace .au-test-result p { margin: 0; }
.automations-workspace .au-result { margin: 6px 0 0; padding-left: 20px; }
.automations-workspace .au-ok { color: #12603f; }
.automations-workspace .au-bad { color: #9b2c22; margin: 0; font-size: 13px; }
.automations-workspace .au-muted { color: var(--au-ink-2); }
.automations-workspace .au-runs { width: 100%; border-collapse: collapse; font-size: 13px; }
.automations-workspace .au-runs th { text-align: left; font-size: 11px; color: var(--au-ink-2); font-weight: 650; padding: 0 8px 8px 0; border-bottom: 1px solid var(--au-line); }
.automations-workspace .au-runs td { padding: 9px 8px 9px 0; border-bottom: 1px solid #eff3f0; vertical-align: top; }
.automations-workspace .au-runs td:first-child { white-space: nowrap; }
.automations-workspace .au-runs a { color: var(--au-accent); font-weight: 600; white-space: nowrap; }
.automations-workspace .au-empty { margin: 0; padding: 16px; border: 1px dashed #d4ddd6; border-radius: 10px; color: var(--au-ink-2); font-size: 13px; text-align: center; background: #fbfcfb; }
.automations-workspace .au-blank { padding: 40px 16px; text-align: center; color: var(--au-ink-2); border: 1px dashed #d4ddd6; border-radius: 14px; }
.automations-workspace .au-blank p { margin: 0; }
.automations-workspace .au-intro { display: grid; gap: 18px; }
.automations-workspace .au-intro-text { max-width: 640px; }
.automations-workspace .au-intro-text .icon { width: 28px; height: 28px; color: var(--au-accent); margin-bottom: 8px; }
.automations-workspace .au-intro-text h2 { margin: 0 0 6px; }
.automations-workspace .au-intro-text p { color: var(--au-ink-2); margin: 0 0 14px; }
.automations-workspace .au-templates h3 { font-size: 14px; margin: 0 0 10px; }
.automations-workspace .au-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.automations-workspace .au-template { display: grid; gap: 4px; text-align: left; padding: 12px 14px; border: 1px solid var(--au-line); border-radius: 12px; background: #fff; color: inherit; }
.automations-workspace .au-template:hover { border-color: var(--au-accent); }
.automations-workspace .au-template strong { font-size: 13px; }
.automations-workspace .au-template small { color: var(--au-ink-2); font-size: 12px; line-height: 1.45; }
.automations-workspace .au-note { margin: 0 0 12px; font-size: 13px; color: var(--au-ink-2); }
.automations-workspace .au-review-head { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.automations-workspace .au-review-head .au-field { min-width: 180px; }
.automations-workspace .au-tasks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.automations-workspace .au-task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; padding: 14px; background: #fff; border: 1px solid var(--au-line); border-radius: 12px; }
.automations-workspace .au-task strong { display: block; margin: 3px 0; font-size: 14px; }
.automations-workspace .au-task p { margin: 0 0 6px; font-size: 13px; line-height: 1.5; }
.automations-workspace .au-task small { display: block; color: var(--au-ink-2); font-size: 12px; }
.automations-workspace .au-kind { font-size: 11px; font-weight: 650; color: var(--au-ink-2); text-transform: uppercase; letter-spacing: .03em; }
.automations-workspace .au-task-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; }
.automations-workspace .au-task-actions .btn { padding: 7px 12px; font-size: 13px; }
.automations-workspace .au-compare { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.automations-workspace .au-compare pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; margin: 6px 0 0; padding: 10px; background: var(--au-soft); border-radius: 8px; font-size: 12px; }
@media (max-width: 960px) {
  .automations-workspace .au-layout { grid-template-columns: minmax(0, 1fr); }
  .automations-workspace .au-list { position: static; }
  .automations-workspace .au-triggers { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .automations-workspace .au-step { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .automations-workspace .au-step > :nth-child(3):not(.au-move):not(.au-icon) { grid-column: 2 / -1; grid-row: 2; }
  .automations-workspace .au-step > select:nth-child(2):nth-last-child(2) { grid-column: 2; }
  .automations-workspace .au-task { grid-template-columns: minmax(0, 1fr); }
  .automations-workspace .au-task-actions, .automations-workspace .au-buttons { justify-content: flex-start; }
  .automations-workspace .au-compare { grid-template-columns: minmax(0, 1fr); }
}
[data-theme="dark"] .automations-workspace { --au-ink-2: #a9aec0; --au-line: #3a3e4d; --au-soft: #1f2230; --au-accent: #32a676; }
[data-theme="dark"] .automations-workspace .au-editor, [data-theme="dark"] .automations-workspace .au-card, [data-theme="dark"] .automations-workspace .au-open,
[data-theme="dark"] .automations-workspace .au-template, [data-theme="dark"] .automations-workspace .au-task { background: #272a37; color: #eef0f7; }
[data-theme="dark"] .automations-workspace .au-step select, [data-theme="dark"] .automations-workspace .au-step input, [data-theme="dark"] .automations-workspace .au-step textarea { background: #181a23; }
[data-theme="dark"] .automations-workspace .au-num { background: #181a23; }
[data-theme="dark"] .automations-workspace .au-switch { background: #1d2b25; border-color: #2c4a3c; color: #e3efe8; }
[data-theme="dark"] .automations-workspace .au-switch.paused { background: #2e2817; border-color: #5a4a22; color: #f2e8cf; }
[data-theme="dark"] .automations-workspace .au-tabs { border-bottom-color: var(--au-line); }
[data-theme="dark"] .automations-workspace .au-tabs button { color: #bcc0d1; }
[data-theme="dark"] .automations-workspace .au-tabs button[aria-selected="true"] { color: #eef0f7; }
[data-theme="dark"] .automations-workspace .au-count:not(:empty), [data-theme="dark"] .automations-workspace .au-badge { background: #2c4a3c; color: #e3efe8; }
[data-theme="dark"] .automations-workspace .au-trigger:has(input:checked), [data-theme="dark"] .automations-workspace .au-chip:has(input:checked) { background: #1d2b25; }
[data-theme="dark"] .automations-workspace .au-pill { background: #343848; color: #d5d8e4; }
[data-theme="dark"] .automations-workspace .au-pill.on, [data-theme="dark"] .automations-workspace .au-pill.ok { background: #1d3a2d; color: #8fdcb5; }
[data-theme="dark"] .automations-workspace .au-pill.changed, [data-theme="dark"] .automations-workspace .au-pill.wait { background: #3d321a; color: #f0cf86; }
[data-theme="dark"] .automations-workspace .au-pill.bad { background: #43231f; color: #f2a59b; }
[data-theme="dark"] .automations-workspace .au-problems { background: #43231f; color: #f6c7c0; }
[data-theme="dark"] .automations-workspace .au-ok { color: #8fdcb5; }
[data-theme="dark"] .automations-workspace .au-bad { color: #f2a59b; }
[data-theme="dark"] .automations-workspace .au-icon { color: #c9cddb; }
[data-theme="dark"] .automations-workspace .au-icon:hover:not(:disabled) { background: #343848; }
[data-theme="dark"] .automations-workspace .au-empty, [data-theme="dark"] .automations-workspace .au-blank { background: transparent; border-color: #454a5b; }
[data-theme="dark"] .automations-workspace .au-runs td { border-bottom-color: #31343f; }
[data-theme="dark"] .automations-workspace .au-toggle input { background: #4a4f60; }
[data-theme="dark"] .automations-workspace .au-toggle input:checked { background: var(--au-accent); }
