/* automations.css */

.automations-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr);
  gap: 20px;
}

@media (max-width: 1000px) {
  .automations-layout {
    grid-template-columns: 1fr;
  }
}

.auto-col-main, .auto-col-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Settings Card */
.auto-settings-card .card-head {
  padding-bottom: 20px;
}

.auto-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.auto-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.auto-switch i {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d6dcd8;
  transition: .4s;
  border-radius: 24px;
}

.auto-switch i:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.auto-switch input:checked + i {
  background-color: var(--green);
}

.auto-switch input:checked + i:before {
  transform: translateX(20px);
}

/* Rules Grid */
.auto-rules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 20px;
}

.auto-rule-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.auto-rule-card:hover {
  border-color: #b9d8c8;
}

.auto-rule-card:has(input:checked) {
  border-color: var(--green);
  background: var(--green2);
}

.auto-rule-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
}

.auto-rule-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auto-rule-info b {
  font-size: 14px;
  color: var(--ink);
}

.auto-rule-info small {
  font-size: 12px;
  color: var(--muted);
}

.auto-timing-grid,
.auto-senders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  padding: 0 20px 20px;
}

.auto-timing-grid label,
.auto-senders label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.auto-timing-grid input,
.auto-senders select {
  width: 100%;
}

/* Graduated path/source matrix */
.automation-global{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;margin-bottom:18px;background:#132c2a;color:#fff;border:0}
.automation-global h3{margin:0;font:700 16px Manrope}.automation-global p{margin:4px 0 0;color:#b7cbc2;font-size:11px}
.matrix-workspace{display:grid;grid-template-columns:minmax(0,1fr);gap:17px;align-items:start;margin-bottom:18px}
.automation-matrix-card{overflow:hidden}.matrix-toolbar{display:flex;gap:10px;justify-content:space-between;padding:15px 17px;border-bottom:1px solid var(--line)}
.automation-page-buttons{display:flex;gap:8px}.auto-scope-card{display:none}
.matrix-toolbar input,.matrix-toolbar select{border:1px solid var(--line);border-radius:8px;padding:10px 11px;background:#fff;font:12px 'DM Sans'}.matrix-toolbar input{min-width:230px}
.matrix-legend{display:flex;gap:15px;padding:11px 17px;color:var(--muted);font-size:10px}.matrix-legend span:first-child{color:var(--green)}.matrix-legend span:nth-child(4){color:var(--red)}
.automation-bulk{display:flex;align-items:center;gap:7px;padding:10px 15px;background:#e7f2ed;border-bottom:1px solid #c9e1d6;color:#275f52;font-size:11px}
.automation-bulk span{margin-right:auto}.automation-matrix{width:100%;table-layout:fixed}.automation-matrix th{padding:11px 13px;text-align:left;color:#7a8982;font-size:9px;letter-spacing:.08em;background:#f5f8f3;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.automation-matrix th:first-child{width:33%}.automation-matrix th small{font-size:8px;font-weight:500;letter-spacing:0}
.automation-matrix td{padding:10px 13px;border-bottom:1px solid var(--line);vertical-align:middle}.automation-path{display:flex;gap:9px;align-items:flex-start}.automation-path input{margin-top:3px;accent-color:var(--green)}.automation-path span{display:grid;gap:3px}.automation-path b{font-size:12px}.automation-path small{color:var(--muted);font-size:10px}.automation-path em{width:max-content;padding:2px 5px;border:1px solid var(--line);border-radius:4px;color:var(--muted);font-size:8px;font-style:normal}
.automation-cell{width:100%;border:1px solid transparent;border-radius:8px;padding:8px 9px;text-align:left;background:transparent;cursor:pointer}.automation-cell:hover{background:#eef6f0;border-color:#cde3d8}.automation-cell i{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:7px;background:#c5cec8}.automation-cell b{font-size:11px}.automation-cell small{display:block;margin:4px 0 0 15px;color:var(--muted);font-size:9px}.automation-cell.on i{background:var(--green)}.automation-cell.on b{color:var(--green)}.automation-cell.inherit i{background:#90a69e}.automation-cell.off i{background:#c5cec8}.automation-cell.blocked{background:#f8f3ef;cursor:not-allowed}.automation-cell.blocked i{background:var(--red)}.automation-cell.blocked b{color:var(--red)}
.automation-side{display:grid;gap:15px}.impact-note{margin:0 15px 15px;padding:11px;border-radius:8px;background:#fff7e6;color:#70511f;font-size:10px;line-height:1.5}
.automation-draft-banner{display:flex;align-items:center;gap:12px;padding:12px 15px;margin-bottom:15px;border:1px solid #edd9a9;border-radius:10px;background:#fff8e9;color:#70511f;font-size:11px}.automation-draft-banner span{margin-right:auto}
@media(max-width:1100px){.matrix-workspace{grid-template-columns:1fr}.automation-side{grid-template-columns:1fr 1fr}}
@media(max-width:720px){.matrix-workspace{display:block}.automation-side{margin-top:15px}.automation-matrix-card{overflow:auto}.automation-matrix{min-width:720px}.matrix-toolbar,.matrix-legend,.automation-bulk{min-width:720px}}

.auto-timing-grid small {
  font-weight: 500;
  color: var(--muted);
}

/* Scope Card */
.auto-scope-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.scope-modes {
  display: flex;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.scope-modes label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.scope-modes input {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}

.scope-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  transition: opacity 0.3s;
}

.scope-source-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfa;
  cursor: pointer;
}

.scope-source-card:has(input:checked) {
  border-color: var(--green);
  background: var(--white);
}

.scope-source-checkbox {
  margin-top: 2px;
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}

.scope-source-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scope-source-info b {
  font-size: 13px;
}

.scope-source-info small {
  font-size: 11px;
  color: var(--muted);
}

.scope-options {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

/* Preview Summary */
.preview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 16px;
  background: #fafbfa;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.operating-window { margin: 0 20px 20px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 14px; background: #fafbfa; }
.operating-window > div:first-child { display: grid; gap: 3px; }
.operating-window small { color: var(--muted); font-weight: 500; }
.operating-weekdays { display: flex; flex-wrap: wrap; gap: 8px; }
.operating-weekdays label { display: flex; align-items: center; gap: 5px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 12px; }
.operating-weekdays input { accent-color: var(--green); }
.operating-hours { display: grid; grid-template-columns: repeat(2, minmax(120px, 180px)); gap: 12px; }
.operating-hours label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; }

.summary-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.summary-box span {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}

.summary-box b {
  font-size: 18px;
  font-family: Manrope, sans-serif;
  font-weight: 800;
}

.summary-box.success b {
  color: var(--green);
}

.summary-box.danger b {
  color: var(--red);
}

.summary-box.warning b {
  color: #9a6700;
}

@media (max-width: 1050px) {
  .preview-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.auto-preview-card table td {
  padding: 12px 18px;
}

.auto-preview-card .empty {
  padding: 30px 20px;
}

.auto-senders {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0 20px 20px;
}

.auto-senders label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.auto-senders select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 11px;
  font: 12px 'DM Sans';
  background: white;
  outline: 0;
  width: 100%;
}
