.pool-automation-host {
  width: 100%;
}

.pool-automation {
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  color: #172033;
}

.pool-automation *,
.pool-automation *::before,
.pool-automation *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

.pool-automation__header {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #e6ebf1;
  background: #f8fafc;
}

.pool-automation__eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #147d64;
  font-size: 11px;
  font-weight: 700;
}

.pool-automation h2,
.pool-automation h3 {
  margin: 0;
  color: #152238;
  font-weight: 700;
}

.pool-automation h2 { font-size: 17px; }
.pool-automation h3 { font-size: 14px; }

.pool-task-badge {
  display: inline-flex;
  min-width: 92px;
  height: 30px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #d9e1ea;
  border-radius: 6px;
  background: #ffffff;
  color: #5c687a;
  font-size: 12px;
  font-weight: 600;
}

.pool-task-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.pool-task-badge.is-running,
.pool-task-badge.is-waiting,
.pool-task-badge.is-stopping { border-color: #9ad7c8; color: #0d755d; }
.pool-task-badge.is-running i,
.pool-task-badge.is-waiting i,
.pool-task-badge.is-stopping i { background: #13a37f; }
.pool-task-badge.is-completed { border-color: #a8d4b9; color: #187240; }
.pool-task-badge.is-completed i { background: #23a55a; }
.pool-task-badge.is-failed { border-color: #f2b8b5; color: #b42318; }
.pool-task-badge.is-failed i { background: #d92d20; }

.pool-automation__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.pool-tool {
  min-width: 0;
  padding: 18px 20px 20px;
}

.pool-tool + .pool-tool { border-left: 1px solid #e6ebf1; }

.pool-tool__title {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pool-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: #49566a;
  font-size: 12px;
}

.pool-switch input {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 34px;
  height: 19px;
  cursor: pointer;
  opacity: 0;
}

.pool-switch span {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 10px;
  background: #b8c2cf;
  transition: background 160ms ease;
}

.pool-switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  content: '';
  transition: transform 160ms ease;
}

.pool-switch input:checked + span { background: #147d64; }
.pool-switch input:checked + span::after { transform: translateX(15px); }
.pool-switch input:focus-visible + span { outline: 2px solid #2f6fed; outline-offset: 2px; }
.pool-switch b { font-weight: 600; }

.pool-form-grid,
.pool-export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pool-form-grid__wide { grid-column: 1 / -1; }

.pool-account-field { min-width: 0; }

.pool-account-field__label {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.pool-account-field__label > span {
  color: #667085;
  font-size: 11px;
  font-weight: 600;
}

.pool-account-auto {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #536176;
  font-size: 11px;
}

.pool-account-auto input,
.pool-account-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pool-account-auto i,
.pool-account-option i {
  position: relative;
  display: inline-flex;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b9c5d2;
  border-radius: 4px;
  background: #ffffff;
}

.pool-account-auto input:checked + i,
.pool-account-option input:checked + i {
  border-color: #147d64;
  background: #147d64;
}

.pool-account-auto input:checked + i::after,
.pool-account-option input:checked + i::after {
  width: 7px;
  height: 4px;
  border-bottom: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  content: '';
  transform: translateY(-1px) rotate(-45deg);
}

.pool-account-auto input:focus-visible + i,
.pool-account-option input:focus-visible + i {
  outline: 2px solid #2f6fed;
  outline-offset: 2px;
}

.pool-account-auto b { font-weight: 600; }

.pool-account-list {
  display: grid;
  max-height: 132px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  overflow-y: auto;
  border: 1px solid #d7dfe8;
  border-radius: 6px;
  background: #f8fafc;
  padding: 8px;
}

.pool-account-list.is-disabled { opacity: 0.56; }

.pool-account-option {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 34px;
  grid-template-columns: 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: 1px solid #dce3eb;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  font-size: 11px;
  padding: 7px 8px;
}

.pool-automation .pool-account-option > span {
  overflow: hidden;
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pool-account-option em {
  color: #8a96a8;
  font-size: 10px;
  font-style: normal;
}

.pool-account-option em.is-online { color: #147d64; }
.pool-account-option em.is-starting { color: #9a6700; }
.pool-account-empty { color: #8a96a8; font-size: 11px; padding: 6px; }

.pool-automation label > span,
.pool-dog-filter legend {
  display: block;
  margin-bottom: 6px;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
}

.pool-automation input[type='time'],
.pool-automation input[type='number'],
.pool-automation select {
  width: 100%;
  height: 38px;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  outline: 0;
  background: #ffffff;
  color: #233047;
  font: inherit;
  font-size: 12px;
  padding: 0 10px;
}

.pool-automation input:focus,
.pool-automation select:focus {
  border-color: #2f6fed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.pool-input-suffix { position: relative; }
.pool-input-suffix input { padding-right: 32px !important; }
.pool-input-suffix em {
  position: absolute;
  top: 0;
  right: 11px;
  display: flex;
  height: 38px;
  align-items: center;
  color: #78859a;
  font-size: 11px;
  font-style: normal;
  pointer-events: none;
}

.pool-task-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #e1e7ee;
  border-radius: 6px;
  background: #e1e7ee;
}

.pool-task-metrics div {
  min-width: 0;
  padding: 9px 10px;
  background: #f8fafc;
}

.pool-task-metrics span,
.pool-task-metrics strong { display: block; }
.pool-task-metrics span { margin-bottom: 3px; color: #78859a; font-size: 10px; }
.pool-task-metrics strong { overflow: hidden; color: #233047; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.pool-progress {
  width: 100%;
  height: 4px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 2px;
  background: #e6ebf1;
}

.pool-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: #147d64;
  transition: width 220ms ease;
}

.pool-tool__actions,
.pool-export-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.pool-btn {
  display: inline-flex;
  min-width: 78px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  padding: 0 14px;
}

.pool-btn:disabled { cursor: default; opacity: 0.48; }
.pool-btn--quiet { border-color: #cfd8e3; background: #ffffff; color: #334155; }
.pool-btn--quiet:hover:not(:disabled) { background: #f3f6f9; }
.pool-btn--primary { background: #186b58; color: #ffffff; }
.pool-btn--primary:hover:not(:disabled) { background: #115746; }
.pool-btn--danger { border-color: #edb6b2; background: #fff7f6; color: #b42318; }
.pool-btn--danger:hover:not(:disabled) { background: #feeceb; }

.pool-export-count {
  display: inline-flex;
  height: 26px;
  align-items: center;
  border-radius: 6px;
  background: #edf3ff;
  color: #285db8;
  font-size: 11px;
  font-weight: 700;
  padding: 0 9px;
}

.pool-dog-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 12px;
  border: 0;
  padding: 0;
}

.pool-dog-filter legend { grid-column: 1 / -1; width: 100%; }

.pool-dog-filter label { position: relative; cursor: pointer; }
.pool-dog-filter input {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}
.pool-dog-filter label span {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 1px solid #d7dfe8;
  border-radius: 6px;
  background: #ffffff;
  color: #536176;
  font-size: 11px;
}

.pool-dog-filter input:checked + span {
  border-color: #2f6fed;
  background: #eef4ff;
  color: #2458ae;
  box-shadow: inset 0 0 0 1px #2f6fed;
}

.pool-dog-filter input:focus-visible + span { outline: 2px solid #2f6fed; outline-offset: 2px; }
.pool-export-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.pool-export-summary {
  justify-content: space-between;
  min-height: 42px;
  margin-top: 14px;
  border-top: 1px solid #e6ebf1;
  padding-top: 13px;
}

.pool-export-summary > span { color: #5d6a7e; font-size: 12px; }

.pool-automation__message {
  margin: 0 20px 16px;
  border-left: 3px solid #2f6fed;
  background: #f2f6ff;
  color: #315b9f;
  font-size: 12px;
  padding: 9px 11px;
}

.pool-automation__message.is-success { border-left-color: #15906f; background: #edf9f5; color: #126b56; }
.pool-automation__message.is-error { border-left-color: #d92d20; background: #fff2f1; color: #a3261c; }

@media (max-width: 1100px) {
  .pool-automation__grid { grid-template-columns: 1fr; }
  .pool-tool + .pool-tool { border-top: 1px solid #e6ebf1; border-left: 0; }
}

@media (max-width: 640px) {
  .pool-automation { margin: 12px 0; }
  .pool-automation__header { align-items: flex-start; padding: 14px; }
  .pool-tool { padding: 15px 14px 16px; }
  .pool-form-grid,
  .pool-export-grid { grid-template-columns: 1fr; }
  .pool-form-grid__wide { grid-column: auto; }
  .pool-account-field__label { align-items: flex-start; flex-direction: column; gap: 6px; }
  .pool-account-list { grid-template-columns: 1fr; }
  .pool-dog-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pool-task-metrics { grid-template-columns: 1fr; }
  .pool-task-metrics div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .pool-task-metrics span { margin: 0; }
  .pool-tool__actions { flex-wrap: wrap; }
  .pool-tool__actions .pool-btn { flex: 1 1 96px; }
  .pool-export-summary { align-items: stretch; flex-direction: column; }
  .pool-export-summary .pool-btn { width: 100%; }
}
